Closed Bug 839645 Opened 12 years ago Closed 6 years ago

Number.prototype.toLocaleString not being based off of phone setting.

Categories

(Firefox OS Graveyard :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: nick, Unassigned)

References

Details

(Keywords: l12y, Whiteboard: [l10n])

I'm trying to have a calculator app display the proper decimal mark.  I call toLocaleString on the final result of the calculation.  On a test device, I've changed the language to French.  The French decimal mark is a ','.  Yet the decimal mark remains a '.'.  This can be verified in the browser application as well: http://chris.photobooks.com/tests/overflow/1074660.htm

STR:

1. Connect to wifi
2. Change language on test device to french.
3. Open browser
4. http://chris.photobooks.com/tests/overflow/1074660.htm

Expected ',', actual '.'
toLocaleString depends on OS behaviour, I'm not sure what of that we're shipping, nor if we're setting the locale on the OS level.
Component: Gaia → General
Keywords: l12y
Whiteboard: [l10n]
What happens is that we don't have localeconv enabled on Gonk and we don't have global variable for decimals, so you end up with defaults.

Code: https://mxr.mozilla.org/mozilla-central/source/js/src/jsnum.cpp#1049
and the reason is here:

https://github.com/android/platform_bionic/blob/master/libc/README

"Bionic is mainly a port of the BSD C library to our Linux kernel with the
following additions/changes:

- no support for locales (...)"

I think we will get this resolved when we get bug 769872 resolved and if we land it for GONK port as well.

Setting needinfo on Norbert to confirm before I set dependency
Flags: needinfo?(mozillabugs)
Yes, that's the kind of issue that the ECMAScript Internationalization API intends to address. The tracking bug for that API is now bug 837963. It's not quite clear yet though how that API is going to be implemented in Firefox OS - hopefully the ICU library that's in the B2G/Android sources makes it into the builds and the API can use it.
Depends on: es-intl
Flags: needinfo?(mozillabugs)
Depends on: 866301
No longer depends on: es-intl
I just ran into the same problem for Date:

Console interaction with my app via WebIDE:

< (new Date).toLocaleString()
> "Thu Apr 23 08:41:34 2015"
< navigator.language
> "de"
< navigator.languages
> Array [ "de", "en-US", "en" ]
< navigator.userAgent
> "Mozilla/5.0 (Mobile; rv:40.0) Gecko/40.0 Firefox/40.0"
< navigator.buildID
> "20150422160203"

I see this with latest nightly on my Flame device:

version	3.0.0.0-prerelease
appbuildid	20150422160203
platformbuildid	20150422160203
platformversion	40.0a1
geckobuildid	20150422160203
geckoversion	40.0a1
changeset	a9311ec2dd39
locale	en-US
os	B2G
hardware	qcom
processor	arm
In my nightly Firefox on Windows I get this, as expected:

(new Date).toLocaleString()
    23.4.2015 09:05:35
document.lastModified
    04/23/2015 09:05:35
navigator.buildID
    20150422030206
navigator.javaEnabled()
    true
navigator.language
    de
navigator.languages
    de,en-US
navigator.userAgent
    Mozilla/5.0 (Windows NT 5.1; rv:40.0) Gecko/20100101 Firefox/40.0
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.