From 8f2a1472ae82c5f0a2067540eafffb596869a919 Mon Sep 17 00:00:00 2001 From: thediaval Date: Tue, 3 Dec 2019 15:51:40 +0300 Subject: [PATCH] improvement(core): change localization key type --- .../core/src/lib/services/localization.service.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/services/localization.service.ts b/npm/ng-packs/packages/core/src/lib/services/localization.service.ts index d3dd746fa6..d87d28a938 100644 --- a/npm/ng-packs/packages/core/src/lib/services/localization.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/localization.service.ts @@ -4,6 +4,7 @@ import { Store } from '@ngxs/store'; import { noop, Observable } from 'rxjs'; import { ConfigState } from '../states/config.state'; import { registerLocale } from '../utils/initial-utils'; +import { Config } from '../models/config'; type ShouldReuseRoute = (future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot) => boolean; @@ -21,7 +22,7 @@ export class LocalizationService { @SkipSelf() otherInstance: LocalizationService, ) { - if (otherInstance) throw new Error('LocaleService should have only one instance.'); + if (otherInstance) throw new Error('LocalizationService should have only one instance.'); } setRouteReuse(reuse: ShouldReuseRoute) { @@ -41,11 +42,14 @@ export class LocalizationService { }); } - get(key: string, ...interpolateParams: string[]): Observable { + get( + key: string | Config.LocalizationWithDefault, + ...interpolateParams: string[] + ): Observable { return this.store.select(ConfigState.getLocalization(key, ...interpolateParams)); } - instant(key: string, ...interpolateParams: string[]): string { + instant(key: string | Config.LocalizationWithDefault, ...interpolateParams: string[]): string { return this.store.selectSnapshot(ConfigState.getLocalization(key, ...interpolateParams)); } }