Two or more capital letters logo
Two or more capital letters Free

2 or more capital letters in the translation

Get

Requires Crowdin account

var wordsWithTwoCapitalPattern = new RegExp('(?<=\\s|^)[\\p{Lu}\\p{Lt}]([\\p{Lu}\\p{Lt}]+)[\\p{L}]*', 'gmu');

var result = {
  success: false
};

translation = crowdin.translation;

var translationMatchArray = translation.match(wordsWithTwoCapitalPattern);

if (translationMatchArray != null) {
  result.message = 'The translation text has word(s) starting from 2 or more capitals. Words: ' + translationMatchArray;
  result.fixes = [];

  while ((matchInfo = wordsWithTwoCapitalPattern.exec(translation)) !== null) {
    var fix = {
      from_pos: matchInfo.index + 1,
      to_pos: matchInfo.index + matchInfo[1].length + 1,
      replacement: matchInfo[1].toLowerCase()
    };

    result.fixes.splice(0, 0, fix);
  }
} else {
  result.success = true;
}

return result;
Categories
Tags
Works with
  • Crowdin Enterprise
Details

Released on Jan 18, 2021

Updated on Jul 12, 2024

Published by Crowdin

Identifier:two-or-more-capital-letters-custom