-
Notifications
You must be signed in to change notification settings - Fork 603
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
Fix 220: Create plural module #241
Conversation
// 2: UMD outro | ||
return contents | ||
.replace( /\(function\(root, factory\)[\s\S]*?}\(this, function\(\) {/, "var CLDRPluralRuleParser = (function() {" ) /* 1 */ | ||
.replace( /}\)\);\s+$/, "}());" ); /* 2 */ |
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.
Can you move the second line comment above this line? Same for the other. Also make it more explicit, e.g. "Remove UMD outro"
971866e
to
ce4261c
Compare
Ready for review (or to be landed). A good summary of the changes made by this PR can be seen in the README diff. It creates one more module called |
Globalize.formatPlural( 2, messageData ); // "You have 2 unread messages" | ||
|
||
Globalize.formatPlural( 12345, messageData, Globalize.formatNumber( 12345 ) ); | ||
// 'You have 12,345 unread messages' |
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.
Would be good to use these "output comments" consistently. Either put them after the line in question, before, or on the same line, but don't mix it, like here and with the three above.
Same for the other method.
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.
yeap. done.
zero: "zero" | ||
}; | ||
|
||
assert.equal( en.formatPlural( 0, fakeFormatValue ), "other", "" ); |
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.
No need for the empty message argument, its optional. The API docs for wrong until a week ago.
Borrow santhoshtr/CLDRPluralRuleParser. Ref #220
Thanks @jzaefferer, I've updated it based on your comments. |
This should provide a decent error message: Globalize.formatPlural(2, { one: "{0} thing" }) Instead I get This uses the value instead of the empty string: // "2 things"
Globalize.formatPlural(2, { other: "{0} things" }, "") |
Thanks @jzaefferer, both fixed and covered by new functional tests. |
Borrow santhoshtr/CLDRPluralRuleParser.
Ref #220