diff --git a/common/src/main/java/com/box/l10n/mojito/okapi/filters/POFilter.java b/common/src/main/java/com/box/l10n/mojito/okapi/filters/POFilter.java index 73f8670851..7a10ca4e96 100644 --- a/common/src/main/java/com/box/l10n/mojito/okapi/filters/POFilter.java +++ b/common/src/main/java/com/box/l10n/mojito/okapi/filters/POFilter.java @@ -156,7 +156,8 @@ void processTextUnit(Event event) { if (event != null && event.isTextUnit()) { TextUnit textUnit = (TextUnit) event.getTextUnit(); renameTextUnitWithSourceAndContent(textUnit); - unescpae(textUnit); + // temp LXP-1094 + // unescpae(textUnit); addUsagesToTextUnit(textUnit); } } @@ -347,7 +348,7 @@ void retainForms(LocaleId localeId, List pluralForms) { } } - /** + /** * If context is present, add it to the text unit name. We keep the generated ID by Okapi for * prefix of the text unit name allows to distinguish plural form easily. * @@ -357,24 +358,32 @@ void retainForms(LocaleId localeId, List pluralForms) { * * @param textUnit */ - void renameTextUnitWithSourceAndContent(ITextUnit textUnit) { - - Property property = textUnit.getProperty(POFilter.PROPERTY_CONTEXT); + void renameTextUnitWithSourceAndContent(ITextUnit textUnit) { - StringBuilder newName = new StringBuilder(msgID); + Property property = textUnit.getProperty(POFilter.PROPERTY_CONTEXT); - if (property != null) { - newName.append(" --- ").append(property.getValue()); - } + // temp LXP-1094: use unescaped content for name: source from Okapi (singular) or + // replaceEscapedCharacters(msgID) (plural), so ID displays correctly. + String baseName; + if (poPluralForm == null) { + baseName = textUnitUtils.getSourceAsString(textUnit); + } else { + baseName = unescapeUtils.replaceEscapedCharacters(msgID != null ? msgID : ""); + } + StringBuilder newName = new StringBuilder(baseName); - if (poPluralForm != null) { - String cldrForm = poPluralRule.poFormToCldrForm(Integer.toString(poPluralForm)); - newName.append(PLURAL_SEPARATOR).append(cldrForm); - } + if (property != null) { + newName.append(" --- ").append(property.getValue()); + } - textUnit.setName(newName.toString()); + if (poPluralForm != null) { + String cldrForm = poPluralRule.poFormToCldrForm(Integer.toString(poPluralForm)); + newName.append(PLURAL_SEPARATOR).append(cldrForm); } + textUnit.setName(newName.toString()); +} + /** * Rewrite the plural forms if processing a target locale. *