Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -347,7 +348,7 @@ void retainForms(LocaleId localeId, List<String> 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.
*
Expand All @@ -357,24 +358,32 @@ void retainForms(LocaleId localeId, List<String> 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.
*
Expand Down
Loading