Skip to content

Commit

Permalink
feat(common): export NgLocaleLocalization (#13367)
Browse files Browse the repository at this point in the history
Closes #11921
  • Loading branch information
Dzmitry Shylovich authored and vicb committed Dec 12, 2016
1 parent 8a8c532 commit 56dce0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion modules/@angular/common/src/common.ts
Expand Up @@ -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';
Expand Down
6 changes: 3 additions & 3 deletions modules/@angular/common/src/localization.ts
Expand Up @@ -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:
Expand Down Expand Up @@ -431,4 +431,4 @@ export function getPluralCase(locale: string, nLike: number | string): Plural {
default:
return Plural.Other;
}
}
}
7 changes: 7 additions & 0 deletions tools/public_api_guard/common/index.d.ts
Expand Up @@ -135,6 +135,13 @@ export declare class NgIf {
constructor(_viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext>);
}

/** @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;
Expand Down

0 comments on commit 56dce0e

Please sign in to comment.