mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
19 lines
494 B
TypeScript
19 lines
494 B
TypeScript
|
|
/**
|
||
|
|
* @experimental
|
||
|
|
*/
|
||
|
|
export abstract class NgLocalization { abstract getPluralCategory(value: any): string; }
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Returns the plural category for a given value.
|
||
|
|
* - "=value" when the case exists,
|
||
|
|
* - the plural category otherwise
|
||
|
|
*
|
||
|
|
* @internal
|
||
|
|
*/
|
||
|
|
export function getPluralCategory(
|
||
|
|
value: number, cases: string[], ngLocalization: NgLocalization): string {
|
||
|
|
const nbCase = `=${value}`;
|
||
|
|
|
||
|
|
return cases.indexOf(nbCase) > -1 ? nbCase : ngLocalization.getPluralCategory(value);
|
||
|
|
}
|