Closed
Bug 544414
Opened 15 years ago
Closed 14 years ago
Use locale info when converting numbers to string in JS on Android
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
fennec | 2.0b4+ | --- |
People
(Reporter: mwu, Assigned: alexp)
References
Details
Attachments
(1 file)
3.33 KB,
patch
|
blassey
:
review+
sayrer
:
review+
|
Details | Diff | Splinter Review |
Android doesn't have a useful localeconv so Number.prototype.toLocaleString can't be handled correctly. Need some kind of workaround.
Updated•14 years ago
|
tracking-fennec: --- → 2.0+
Updated•14 years ago
|
tracking-fennec: 2.0+ → 2.0b3+
Updated•14 years ago
|
Assignee: general → blassey.bugs
Updated•14 years ago
|
tracking-fennec: 2.0b3+ → 2.0b4+
Updated•14 years ago
|
Assignee: blassey.bugs → alexp
Assignee | ||
Comment 1•14 years ago
|
||
As a possible solution we could add some environment variables, like LOCALE_DECIMAL_POINT, LOCALE_THOUSANDS_SEP, LOCALE_GROUPING, and check them here: http://mxr.mozilla.org/mozilla-central/source/js/src/jsnum.cpp#1010
I've been also thinking about having some kind of a shunt like we had for WinCE. But this would make sense only if there are some other things, which could be implemented there.
Any other suggestions?
Assignee | ||
Comment 2•14 years ago
|
||
Proposed fix using environment variables.
Assignee | ||
Comment 3•14 years ago
|
||
Changed description to be more specific for this one as there is another meta bug 616377.
Summary: Handle locales correctly on Android → Use locale info when converting numbers to string in JS on Android
Assignee | ||
Comment 4•14 years ago
|
||
Comment on attachment 493477 [details] [diff] [review]
Fix
After further investigation of related bugs this fix looks like a sensible approach. Let's review it.
Someone from JS team will need to have a look at this as well.
Attachment #493477 -
Flags: review?(blassey.bugs)
Comment 5•14 years ago
|
||
Comment on attachment 493477 [details] [diff] [review]
Fix
> #ifndef HAVE_LOCALECONV
>- rt->thousandsSeparator = JS_strdup(cx, "'");
>- rt->decimalSeparator = JS_strdup(cx, ".");
>- rt->numGrouping = JS_strdup(cx, "\3\0");
>+ const char* thousands_sep = getenv("LOCALE_THOUSANDS_SEP");
>+ const char* decimal_point = getenv("LOCALE_DECIMAL_POINT");
>+ const char* grouping = getenv("LOCALE_GROUPING");
>+
>+ rt->thousandsSeparator =
>+ JS_strdup(cx, thousands_sep ? thousands_sep : "'");
>+ rt->decimalSeparator =
>+ JS_strdup(cx, decimal_point ? decimal_point : ".");
>+ rt->numGrouping =
>+ JS_strdup(cx, grouping ? grouping : "\3\0");
we might only want to do this for android (i.e. #ifdef ANDROID), but someone from the js team should make that call
Attachment #493477 -
Flags: review?(sayrer)
Attachment #493477 -
Flags: review?(blassey.bugs)
Attachment #493477 -
Flags: review+
Updated•14 years ago
|
Attachment #493477 -
Flags: review?(sayrer) → review+
Comment 6•14 years ago
|
||
this was pushed:
http://hg.mozilla.org/mozilla-central/rev/06a91c14588d
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•