https://github.com/csabapalfi/norwegian-numbers
💥Demo: Norwegian number formatting issue in node.js
https://github.com/csabapalfi/norwegian-numbers
bug demo intl nodejs
Last synced: 2 months ago
JSON representation
💥Demo: Norwegian number formatting issue in node.js
- Host: GitHub
- URL: https://github.com/csabapalfi/norwegian-numbers
- Owner: csabapalfi
- Created: 2018-08-14T09:08:30.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-02-20T23:57:13.000Z (about 5 years ago)
- Last Synced: 2025-01-25T14:21:48.274Z (4 months ago)
- Topics: bug, demo, intl, nodejs
- Language: JavaScript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Norwegian number formatting issue in node.js
[](https://travis-ci.org/csabapalfi/norwegian-numbers)
Norway used to use the `no` (Norwegian) language code that's considered legacy now. [ISO_639-1]( https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) 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`](https://github.com/unicode-org/icu/blob/master/icu4c/source/data/lang/no.txt). 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?).
```js
// 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'
```