Add extra check that a feature is added on the right level; automatically add the right level to a new point

This commit is contained in:
Pieter Vander Vennet 2022-07-25 16:55:44 +02:00
parent 038b2ece4c
commit effd75e95c
8 changed files with 140 additions and 46 deletions

View file

@ -317,6 +317,19 @@ export class TypedTranslation<T> extends Translation {
return Utils.SubstituteKeys(template, text, lang);
}, context)
}
PartialSubs<X extends string>(text: Partial<T> & Record<X, string>): TypedTranslation<Omit<T, X>> {
const newTranslations : Record<string, string> = {}
for (const lang in this.translations) {
const template = this.translations[lang]
if(lang === "_context"){
newTranslations[lang] = template
continue
}
newTranslations[lang] = Utils.SubstituteKeys(template, text, lang)
}
return new TypedTranslation<Omit<T, X>>(newTranslations, this.context)
}
}