version 1.0.0

This commit is contained in:
_Bastler 2021-11-05 18:25:29 +01:00
parent 2beffaf157
commit 43c52acd33
2 changed files with 9 additions and 15 deletions

View File

@ -65,39 +65,34 @@ export class I18nService {
}
get(key, args: string[]): string {
return this.getInternal(key, args, this.i18n);
return this.getInternal(key, args, this.i18n, "");
}
getInternal(key, args: string[], from): string {
getInternal(key, args: string[], from, path): string {
key += '';
if (!from) {
if (args && args.length > 0) {
return key + "[" + args + "]";
}
return key;
return this.empty(key, args, path);
} else if (from[ key ]) {
if (typeof from[ key ] === 'object') {
if (from[ key ][ "." ]) {
return this.insertArguments(from[ key ][ "." ], args);
}
if (args && args.length > 0) {
return key + "[" + args + "]";
}
return this.empty(key, args, path);
}
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 ] ])
return this.getInternal(key, args, from[ keys[ 0 ] ], path + keys[ 0 ] + ".")
}
}
if (args && args.length > 0) {
return key + "[" + args + "]";
}
return this.empty(key, args, path);
}
return key;
empty(key, args: string[], path): string {
return (path ? path + "." : "") + key + (args ? (" [" + args + "]") : "");
}
insertArguments(label: string, args: string[]) {

View File

@ -15,7 +15,6 @@ import { SettingsService } from '../../services/settings.service';
templateUrl: './main.ui.html',
styleUrls: [ './main.ui.scss' ]
})
export class UiMain {
opened = true;
darkTheme: boolean = false;