Fix i18n word dedupe casing variants
This commit is contained in:
@@ -275,7 +275,24 @@ const transformLocale = (locale, originalMessages) => {
|
|||||||
(entry) => normalizeToken(entry.value) === normalized
|
(entry) => normalizeToken(entry.value) === normalized
|
||||||
);
|
);
|
||||||
if (existingWordEntry) {
|
if (existingWordEntry) {
|
||||||
tokenToWord.set(normalized, { path: `words.${existingWordEntry.key}`, value: existingWordEntry.value });
|
const word = {
|
||||||
|
path: `words.${existingWordEntry.key}`,
|
||||||
|
value: existingWordEntry.value,
|
||||||
|
variants: new Map(),
|
||||||
|
};
|
||||||
|
|
||||||
|
const casings = [...stat.casings.keys()].sort(compareStringValues);
|
||||||
|
for (const casing of casings) {
|
||||||
|
if (modifierForToken(casing, word) !== null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const variantKey = slugify(`${normalized}_${casing}`, usedKeys);
|
||||||
|
generatedWords[variantKey] = casing;
|
||||||
|
word.variants.set(casing, { path: `words.generated.${variantKey}`, value: casing });
|
||||||
|
}
|
||||||
|
|
||||||
|
tokenToWord.set(normalized, word);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user