feat(common): export NgLocaleLocalization (#13367)

Closes #11921
This commit is contained in:
Dzmitry Shylovich 2016-12-12 22:16:12 +03:00 committed by Victor Berchet
parent 8a8c53250e
commit 56dce0e26d
3 changed files with 11 additions and 4 deletions

View File

@ -12,7 +12,7 @@
* Entry point for all public APIs of the common package. * Entry point for all public APIs of the common package.
*/ */
export * from './location/index'; export * from './location/index';
export {NgLocalization} from './localization'; export {NgLocaleLocalization, NgLocalization} from './localization';
export {CommonModule} from './common_module'; export {CommonModule} from './common_module';
export {NgClass, NgFor, NgIf, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet} from './directives/index'; 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'; export {AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe} from './pipes/index';

View File

@ -49,10 +49,10 @@ export function getPluralCategory(
*/ */
@Injectable() @Injectable()
export class NgLocaleLocalization extends NgLocalization { 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 { getPluralCategory(value: any): string {
const plural = getPluralCase(this._locale, value); const plural = getPluralCase(this.locale, value);
switch (plural) { switch (plural) {
case Plural.Zero: case Plural.Zero:

View File

@ -135,6 +135,13 @@ export declare class NgIf {
constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext>); constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext>);
} }
/** @experimental */
export declare class NgLocaleLocalization extends NgLocalization {
protected locale: string;
constructor(locale: string);
getPluralCategory(value: any): string;
}
/** @experimental */ /** @experimental */
export declare abstract class NgLocalization { export declare abstract class NgLocalization {
abstract getPluralCategory(value: any): string; abstract getPluralCategory(value: any): string;