Categories
Ensure the consistency of camelCase words in your translations
Requires Crowdin account
var sourceCamelCaseMatches = crowdin.source.match(/([a-z]+[A-Z][a-zA-Z0-9]*)/g) || [];
var translationText = crowdin.translation;
var check = true;
var missingMatches = [];
for (var i = 0; i < sourceCamelCaseMatches.length; i++) {
if (translationText.indexOf(sourceCamelCaseMatches[i]) === -1) {
check = false;
missingMatches.push(sourceCamelCaseMatches[i]);
}
}
var result = {
success: check
};
if (!check) {
result.message = 'The camelCase words "' + missingMatches.join('", "') + '" from the source text are missing in the translation';
}
return result;