@Test public void testConvertPluralMessageFormatStringToPseudoLoc1() { PseudoLocalization ps = new PseudoLocalization(); Set<TextUnitIntegrityChecker> checkers = new HashSet<>(); checkers.add(new MessageFormatIntegrityChecker()); String pseudoLocalized = ps.convertStringToPseudoLoc("Test {count, plural, one {# v} other {# vf}} with Plurals", checkers); assertTrue("The plural syntax should not be pseudolocalized", pseudoLocalized.contains("count, plural, one")); assertTrue("The plural syntax should not be pseudolocalized", pseudoLocalized.contains("other")); assertTrue("The plural text variation should be pseudolocalized", pseudoLocalized.contains("{# ν}")); assertTrue("The plural text variation should be pseudolocalized", pseudoLocalized.contains("{# νƒ}")); }
public String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers) { TextUnitIntegrityChecker checker = getIntegrityCheckerForPlaceholderProcessing(checkers); if (checker == null) { logger.debug("There is no checker for pseudolocalization placeholder processing."); return convertStringToPseudoLoc(string); } else { logger.debug("Found checker for pseudolocalization placeholder processing."); LocalizableString localizableString = checker.extractNonLocalizableParts(string); String pseudolocalized = convertStringToPseudoLoc(localizableString.getLocalizableString()); localizableString.setLocalizableString(pseudolocalized); return checker.restoreNonLocalizableParts(localizableString); } }
PseudoLocalization { public String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers) { TextUnitIntegrityChecker checker = getIntegrityCheckerForPlaceholderProcessing(checkers); if (checker == null) { logger.debug("There is no checker for pseudolocalization placeholder processing."); return convertStringToPseudoLoc(string); } else { logger.debug("Found checker for pseudolocalization placeholder processing."); LocalizableString localizableString = checker.extractNonLocalizableParts(string); String pseudolocalized = convertStringToPseudoLoc(localizableString.getLocalizableString()); localizableString.setLocalizableString(pseudolocalized); return checker.restoreNonLocalizableParts(localizableString); } } }
PseudoLocalization { public String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers) { TextUnitIntegrityChecker checker = getIntegrityCheckerForPlaceholderProcessing(checkers); if (checker == null) { logger.debug("There is no checker for pseudolocalization placeholder processing."); return convertStringToPseudoLoc(string); } else { logger.debug("Found checker for pseudolocalization placeholder processing."); LocalizableString localizableString = checker.extractNonLocalizableParts(string); String pseudolocalized = convertStringToPseudoLoc(localizableString.getLocalizableString()); localizableString.setLocalizableString(pseudolocalized); return checker.restoreNonLocalizableParts(localizableString); } }  }
PseudoLocalization { public String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers) { TextUnitIntegrityChecker checker = getIntegrityCheckerForPlaceholderProcessing(checkers); if (checker == null) { logger.debug("There is no checker for pseudolocalization placeholder processing."); return convertStringToPseudoLoc(string); } else { logger.debug("Found checker for pseudolocalization placeholder processing."); LocalizableString localizableString = checker.extractNonLocalizableParts(string); String pseudolocalized = convertStringToPseudoLoc(localizableString.getLocalizableString()); localizableString.setLocalizableString(pseudolocalized); return checker.restoreNonLocalizableParts(localizableString); } }  String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers); String convertStringToPseudoLoc(String string); String expand(String string); String convertAsciiToDiacritics(String string); }
PseudoLocalization { public String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers) { TextUnitIntegrityChecker checker = getIntegrityCheckerForPlaceholderProcessing(checkers); if (checker == null) { logger.debug("There is no checker for pseudolocalization placeholder processing."); return convertStringToPseudoLoc(string); } else { logger.debug("Found checker for pseudolocalization placeholder processing."); LocalizableString localizableString = checker.extractNonLocalizableParts(string); String pseudolocalized = convertStringToPseudoLoc(localizableString.getLocalizableString()); localizableString.setLocalizableString(pseudolocalized); return checker.restoreNonLocalizableParts(localizableString); } }  String convertStringToPseudoLoc(String string, Set<TextUnitIntegrityChecker> checkers); String convertStringToPseudoLoc(String string); String expand(String string); String convertAsciiToDiacritics(String string);  }