diff --git a/src/app/services/i18n.service.ts b/src/app/services/i18n.service.ts index c1667f5..6039722 100644 --- a/src/app/services/i18n.service.ts +++ b/src/app/services/i18n.service.ts @@ -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[]) { diff --git a/src/app/ui/main/main.ui.ts b/src/app/ui/main/main.ui.ts index 68499e9..56ecb95 100644 --- a/src/app/ui/main/main.ui.ts +++ b/src/app/ui/main/main.ui.ts @@ -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;