0
The US locale does not respect the ISO standard (see also here):
> number = 1234567.89
< 1234567.89
> LOCALE = 'en-US'
< "en-US"
> number.toLocaleString(LOCALE)
< "1,234,567.89"
The German locale does:
> LOCALE = 'de-DE'
> number.toLocaleString(LOCALE)
< "1.234.567,89"
Is there an international locale which adheres to the ISO standard?
Where can I find the list of locales supported by toLocaleString
? (link)
(tested in the Chrome console)
What's your definition of "an international locale"? – user1686 – 2019-01-10T06:38:44.663
@grawity A locale which respects international standards regarding number formatting, without being tied to a specific language. I am not doing language-related processing, only number formatting. It does not make sense to use
de-DE
, but betteriso-ISO
, if it existed. – dangonfast – 2019-01-10T06:58:12.983@grawity or seen otherwise: I need a "locale" which adheres to international standards regarding number formatting, but which does not concern itself with other localization issues.
toLocaleString
is a method for numeric values. Therefore, it needs a parameter which specifies numeric-related properties, not other language properties. – dangonfast – 2019-01-10T07:09:20.223There is a proposed
– tripleee – 2019-01-10T07:26:56.023en_150
but I don't think it's actually implemented in any real system yet, and it might not support this number format. Cross-site duplicate: https://unix.stackexchange.com/questions/62316/why-is-there-no-euro-english-locale@tripleee that is an interesting take, but my question is actually not related to language properties, simply to numeric properties. I start to think that
toLocaleString
is badly defined: it is not related to locales as defined (which concern themselves with lots of language issues), but simply to number formatting (a subset of the locale issues). Why wouldtoLocaleString
need to get any information about "paper size" for example? The only thing it needs is a definition for the decimal / thousands separators, and eventually an specification on how to format currencies. – dangonfast – 2019-01-10T07:26:57.877