mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 23:44:59 +01:00
Update weblateToCounterpart
to be more resilient (#360)
This commit is contained in:
parent
970832ccfe
commit
2a2e6781c1
@ -74,8 +74,14 @@ function weblateToCounterpart(inTrs) {
|
|||||||
if (keyParts.length === 2) {
|
if (keyParts.length === 2) {
|
||||||
let obj = outTrs[keyParts[0]];
|
let obj = outTrs[keyParts[0]];
|
||||||
if (obj === undefined) {
|
if (obj === undefined) {
|
||||||
obj = {};
|
obj = outTrs[keyParts[0]] = {};
|
||||||
outTrs[keyParts[0]] = obj;
|
} 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];
|
obj[keyParts[1]] = inTrs[key];
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user