问题
Today I became aware of the ECMAScript Internationalisation API, as I was researching a sane way to format numbers. Thus I tested for German by calling
Intl.NumberFormat("de").format(10000.23)
on the console in Firefox and Chrome, which provides me with "10.000,23".
However this form of number formatting is discouraged in German according to the DIN 5008 standard (and the official language reference "Duden"), which says that thin spaces (\u2009) should be used as a thousand separator.
Who defined the use of this thousand separator for German localisation? The Unicode Consortium or the browser vendors?
(Yes, I am aware that some programs and persons may use the dot as German localisation approach)
回答1:
The definition is stemming from the CLDR (Unicode Common Locale Data Repository)
I filed a bug report about this issue there.
回答2:
It's in parts a matter of "better safe than sorry". DIN 5008 section 6.4: "The separator for amounts of money should be the period" (my paraphrasing) and how does a program know that?. Typography with spaces is also a problem in HTML and in most programming languages. You can easily replace periods with spaces but it's more complicated the other way around.
So, it's not a bug, it was done intentionally.
来源:https://stackoverflow.com/questions/33961284/why-does-the-js-internationalization-api-for-number-formatting-contradict-german