mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
modals fully translated
This commit is contained in:
@@ -44,12 +44,14 @@ export class I18nService {
|
||||
this.configService.set("language" as DefaultConfigKey, this.getSupportedLanguages().includes(lang) ? lang : this.LANG_FALLBACK);
|
||||
}
|
||||
|
||||
public translate(translationKey: string): string{
|
||||
const cachedTranlation = this.cache.get(translationKey);
|
||||
if(!!cachedTranlation){ return cachedTranlation; }
|
||||
const tranlated = getProperty(this.dictionary, translationKey);
|
||||
tranlated && this.cache.set(translationKey, tranlated);
|
||||
return tranlated || translationKey;
|
||||
public translate(translationKey: string, args?: Record<string, string>): string{
|
||||
let translated = this.cache.get(translationKey);
|
||||
if(!translated){
|
||||
translated = getProperty(this.dictionary, translationKey);
|
||||
translated ? this.cache.set(translated, translationKey) : translated = translationKey;
|
||||
}
|
||||
args && Object.keys(args).forEach(key => translated = translated.replaceAll(`{${key}}`, args[key]));
|
||||
return translated;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user