/norwegian-numbers

💥Demo: Norwegian number formatting issue in node.js

Primary LanguageJavaScript

Norwegian number formatting issue in node.js

Build Status

Norway used to use the no (Norwegian) language code that's considered legacy now. ISO_639-1 considered it macrolanguage.

The new language code(s) are nb (Bokmål) and nn (Nynorsk) as per Norway's offical languages.

icu4c aliases no to nb. It does the same to no-NO as well.

Node.js uses icu4c data but even with full-icu it seems to ignore the icu4c alias for number formatting. (Maybe all aliases are ignored?).

// npm install full-icu
// node --icu-data-dir=./node_modules/full-icu
const number = 1234.123
number.toLocaleString('nb-NO') // '1 234,123' <-- correct
number.toLocaleString('no-NO') // '1,234.123'