diff --git a/scripts/copy-res.js b/scripts/copy-res.js index 2bf8ea0..a706e9c 100755 --- a/scripts/copy-res.js +++ b/scripts/copy-res.js @@ -74,8 +74,14 @@ function weblateToCounterpart(inTrs) { if (keyParts.length === 2) { let obj = outTrs[keyParts[0]]; if (obj === undefined) { - obj = {}; - outTrs[keyParts[0]] = obj; + obj = outTrs[keyParts[0]] = {}; + } else if (typeof obj === "string") { + // This is a transitional edge case if a string went from singular to pluralised and both still remain + // in the translation json file. Use the singular translation as `other` and merge pluralisation atop. + obj = outTrs[keyParts[0]] = { + "other": inTrs[key], + }; + console.warn("Found entry in i18n file in both singular and pluralised form", keyParts[0]); } obj[keyParts[1]] = inTrs[key]; } else {