forked from MapComplete/MapComplete
No more need to add '.clone()' for compiled translations, removed a bunch of 'clones'
This commit is contained in:
parent
feb684d9e5
commit
9dc8404c43
8 changed files with 56 additions and 61 deletions
|
@ -6,7 +6,6 @@ import BaseUIElement from "../BaseUIElement";
|
|||
export default class Translations {
|
||||
|
||||
static t = AllTranslationAssets.t;
|
||||
private static wtcache = {}
|
||||
|
||||
constructor() {
|
||||
throw "Translations is static. If you want to intitialize a new translation, use the singular form"
|
||||
|
@ -45,15 +44,10 @@ export default class Translations {
|
|||
return undefined;
|
||||
}
|
||||
if (typeof (s) === "string") {
|
||||
if (Translations.wtcache[s]) {
|
||||
return Translations.wtcache[s];
|
||||
}
|
||||
const tr = new Translation({en: s});
|
||||
Translations.wtcache[s] = tr;
|
||||
return tr;
|
||||
return new Translation({en: s});
|
||||
}
|
||||
if (s instanceof Translation) {
|
||||
return s;
|
||||
return s.Clone() /* MUST CLONE HERE! */;
|
||||
}
|
||||
console.error("Trying to Translation.WT, but got ", s)
|
||||
throw "??? Not a valid translation"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue