From 56dce0e26d7e6840d3b3c4c42a5fe7597ae31931 Mon Sep 17 00:00:00 2001 From: Dzmitry Shylovich Date: Mon, 12 Dec 2016 22:16:12 +0300 Subject: [PATCH] feat(common): export NgLocaleLocalization (#13367) Closes #11921 --- modules/@angular/common/src/common.ts | 2 +- modules/@angular/common/src/localization.ts | 6 +++--- tools/public_api_guard/common/index.d.ts | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/@angular/common/src/common.ts b/modules/@angular/common/src/common.ts index 9ca4887ad6..014de76d8a 100644 --- a/modules/@angular/common/src/common.ts +++ b/modules/@angular/common/src/common.ts @@ -12,7 +12,7 @@ * Entry point for all public APIs of the common package. */ export * from './location/index'; -export {NgLocalization} from './localization'; +export {NgLocaleLocalization, NgLocalization} from './localization'; export {CommonModule} from './common_module'; export {NgClass, NgFor, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet} from './directives/index'; export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe} from './pipes/index'; diff --git a/modules/@angular/common/src/localization.ts b/modules/@angular/common/src/localization.ts index 8eaa560165..514a6ef946 100644 --- a/modules/@angular/common/src/localization.ts +++ b/modules/@angular/common/src/localization.ts @@ -49,10 +49,10 @@ export function getPluralCategory( */ @Injectable() export class NgLocaleLocalization extends NgLocalization { - constructor(@Inject(LOCALE_ID) private _locale: string) { super(); } + constructor(@Inject(LOCALE_ID) protected locale: string) { super(); } getPluralCategory(value: any): string { - const plural = getPluralCase(this._locale, value); + const plural = getPluralCase(this.locale, value); switch (plural) { case Plural.Zero: @@ -431,4 +431,4 @@ export function getPluralCase(locale: string, nLike: number | string): Plural { default: return Plural.Other; } -} \ No newline at end of file +} diff --git a/tools/public_api_guard/common/index.d.ts b/tools/public_api_guard/common/index.d.ts index 6003a60e65..f3bd7a4200 100644 --- a/tools/public_api_guard/common/index.d.ts +++ b/tools/public_api_guard/common/index.d.ts @@ -135,6 +135,13 @@ export declare class NgIf { constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef); } +/** @experimental */ +export declare class NgLocaleLocalization extends NgLocalization { + protected locale: string; + constructor(locale: string); + getPluralCategory(value: any): string; +} + /** @experimental */ export declare abstract class NgLocalization { abstract getPluralCategory(value: any): string;