-
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
Plus sign on positive numbers #437
Comments
Please, can you check if UTS#35 Number section has any reference to this? Does any specification/library/language implement this property? What's your use case please? |
Case: |
The Anyway, you can "tell" Globalize that you want such a custom pattern by using the below overload (after you have loaded the standard CLDR data, this code will overload the percentage pattern in memory). Globalize.load({
"main": {
"en": {
"numbers": {
"percentFormats-numberSystem-latn": {
"standard": "+#,##0%;-#,##0%"
}
}
}
}
});
Globalize("en").formatNumber(0.5, {style: "percent"});
// > '+50%'
Globalize("en").formatNumber(-0.5, {style: "percent"});
// > '-50%' @srl295, @JCEmmons, please does ICU provide any mechanism to allow what @balticSD asks? |
@rxaviers sorry for the late response! Yes, it does allow it. It's just a positive prefix, so pattern |
There are unscheduled bugs for this: edit That's the wrong bug number, actually see CldrBug:8732 ( and my later comment below) |
@srl295 Thanks, it definitely helps. @balticSD, so the quick way to accomplish what you need (i.e., using Globalize now) is to load the pattern as suggested above. This is cumbersome if you need to support several locales. Because, it would require you to patch the data for all such supported locales. The long-term (though more solid) way to accomplish this is to weigh in the CLDR ticket that @srl295 has posted above, push for a UTS#35 update, then we get it implemented on Globalize. I know this doesn't sound much fun. But, it's also not as impossible as it sounds. 😝 |
Doesn't have to be that long a term. Once cldr clarifies you could
implement in anticipation, as you like. You might want fallback behavior if
back level cldr is used anyway.
|
@rxaviers @balticSD OK so! The ticket CldrBug:8732 is actually already in review for CLDR. The other was a duplicate which got missed (now closed). See spec changes at here (tr35.html) and here (tr35-numbers.html) - please feel free to review (it's in review) and comment on the original ticket. |
Thanks @srl295, I've left a couple of comments there |
Note to self: html link: http://unicode.org/repos/cldr/trunk/specs/ldml/tr35-numbers.html |
Sorry for my late response. What is the conclusion now? "Globalize.load({" is no solution for me because I have to format different numbers in different way. And "load fomat 1 > format > load format 2 > format..." is a messy workaround. So as option it is not planed? |
@balticSD, please see http://unicode.org/cldr/trac/ticket/8732. All my questions have been answered by Mark Davis and CLDR has been updated accordingly. So, I think we are good to add this feature for Globalize. Would you be willing to champion it? If so, I encourage you to start by suggesting how the Globalize API should look like, then to submit a pull request with the implementation. |
The should be an option to show plus sign on positive number.
Example: +3535.3534
Option: LeadingSign
The text was updated successfully, but these errors were encountered: