fix profile names

This commit is contained in:
_Bastler
2021-11-17 20:40:09 +01:00
parent d2eb8fd261
commit 0f528ac7e0
7 changed files with 29 additions and 11 deletions
+10 -6
View File
@@ -65,30 +65,34 @@ export class I18nService {
}
get(key, args: string[]): string {
return this.getInternal(key, args, this.i18n, "");
return this.getInternal(key, args, this.i18n, "", true);
}
getInternal(key, args: string[], from, path): string {
getEmpty(key, args: string[]): string {
return this.getInternal(key, args, this.i18n, "", false);
}
getInternal(key, args: string[], from, path, empty : boolean): string {
key += '';
if (!from) {
return this.empty(key, args, path);
return empty ? this.empty(key, args, path) : key;
} else if (from[ key ]) {
if (typeof from[ key ] === 'object') {
if (from[ key ][ "." ]) {
return this.insertArguments(from[ key ][ "." ], args);
}
return this.empty(key, args, path);
return empty ? this.empty(key, args, path) : key;
}
return this.insertArguments(from[ key ], args);
} else {
let keys = key.split(".");
if (from[ keys[ 0 ] ]) {
key = keys.slice(1, keys.length).join(".");
return this.getInternal(key, args, from[ keys[ 0 ] ], path + keys[ 0 ] + ".")
return this.getInternal(key, args, from[ keys[ 0 ] ], path + keys[ 0 ] + ".", empty)
}
}
return this.empty(key, args, path);
return empty ? this.empty(key, args, path) : key;
}
empty(key, args: string[], path: string): string {