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 { 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 += ''; key += '';
if (!from) { if (!from) {
if (args && args.length > 0) { return this.empty(key, args, path);
return key + "[" + args + "]";
}
return key;
} else if (from[ key ]) { } else if (from[ key ]) {
if (typeof from[ key ] === 'object') { if (typeof from[ key ] === 'object') {
if (from[ key ][ "." ]) { if (from[ key ][ "." ]) {
return this.insertArguments(from[ key ][ "." ], args); return this.insertArguments(from[ key ][ "." ], args);
} }
if (args && args.length > 0) { return this.empty(key, args, path);
return key + "[" + args + "]";
}
} }
return this.insertArguments(from[ key ], args); return this.insertArguments(from[ key ], args);
} else { } else {
let keys = key.split("."); let keys = key.split(".");
if (from[ keys[ 0 ] ]) { if (from[ keys[ 0 ] ]) {
key = keys.slice(1, keys.length).join("."); 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 this.empty(key, args, path);
return key + "[" + args + "]"; }
}
return key; empty(key, args: string[], path): string {
return (path ? path + "." : "") + key + (args ? (" [" + args + "]") : "");
} }
insertArguments(label: string, args: string[]) { insertArguments(label: string, args: string[]) {

View File

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