I18nPluralPipe
Experimental Pipe
Что он делает
Преобразует значение в строку, которая множит это значение в соответствии с правилами локали.
Как использовать
expression | i18nPlural:mapping
NgModule
CommonModuleОписание
Где:
-
expression— это число. -
mapping— это объект, имитирующий формат ICU, см. http://userguide.icu-project.org/formatparse/messagesПример
@Component({
selector: 'i18n-plural-pipe',
template: `<div>{{ messages.length | i18nPlural: messageMapping }}</div>`
})
export class I18nPluralPipeComponent {
messages: any[] = ['Message 1'];
messageMapping:
{[k: string]: string} = {'=0': 'No messages.', '=1': 'One message.', 'other': '# messages.'};
}
экспортировано из @angular/common/index определено в @angular/common/src/pipes/i18n_plural_pipe.ts
© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/common/index/I18nPluralPipe-pipe.html