-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plural): add plural and select pipes #7268
Conversation
@CONST() | ||
@Pipe({name: 'plural'}) | ||
@Injectable() | ||
export class PluralPipe implements PipeTransform { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name suggestion I18nPluralPipe
???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works!
828c59f
to
86e580f
Compare
@mhevery I think I addressed all the comments. Let me know if there's anything else I should change! |
427cebd
to
ccc89d5
Compare
import {Injectable, PipeTransform, Pipe} from 'angular2/core'; | ||
import {InvalidPipeArgumentException} from './invalid_pipe_argument_exception'; | ||
|
||
var interpolationExp: RegExp = RegExpWrapper.create('#'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it a const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(we discussed and decided to leave as is)
140b482
to
8f2b73c
Compare
bcd0290
to
de34553
Compare
Merging PR #7268 on behalf of @vsavkin to branch presubmit-vsavkin-pr-7268. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
@mhevery @vsavkin Review?
i18n plural pipe
Maps a value to a string that pluralizes the value properly.
Usage
expression | i18nPlural:mapping
where
expression
is a number andmapping
is an object that indicates the proper text forwhen the
expression
evaluates to 0, 1, or some other number. You can interpolate the actualvalue into the text using the
#
sign.Example
i18n select pipe
Generic selector that displays the string that matches the current value.
Usage
expression | i18nSelect:mapping
where
mapping
is an object that indicates the text that should be displayed for different values of the providedexpression
.Example