Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale nb not supported on Node versions >= 14.17.1 and <= 16.8.0 #45784

Closed
synchronos-t opened this issue Dec 8, 2022 · 6 comments
Closed

Comments

@synchronos-t
Copy link

synchronos-t commented Dec 8, 2022

On Node versions 14.17.1 and greater and versions 16.8.0 and smaller Intl.NumberFormat.supportedLocalesOf('nb'); returns an empty array, indicating that the nb locale (Norwegian bokmål) isn't supported. On other versions it correctly returns ['nb'].

Not a problem for Node 16, but is still broken on the newest Node 14 version. From the changelogs of 16.9.0 I couldn't find anything that would be related to locales, so I cannot say what fixed it on Node 16. Nor from the 14.7.1 changelogs anything that might have broken it.

I also tested that the locale does not indeed exist, but instead default to the default locale (at least on my system it's en-US). Thus, this happens:

new Intl.NumberFormat('nb').format(10200.33) // returns '10,200.33'

while it should do, and does on, e.g., 14.17.0, 16.9.0, and 16.18.1:

new Intl.NumberFormat('nb').format(10200.33) // returns '10 200,33'

The same also happens if I use a nb-NO locale string. nn (Norwegian nynorsk) and nn-NO do work.

@richardlau
Copy link
Member

Node.js 14.17.1 updated to ICU 69.1. This is likely related to https://icu.unicode.org/design/norwegian-locales-changes-in-v39.

“nb” and “nn” inherit from a prent locale “no”. This is the first case in which a language-only locale code has a parent other than “root”. Code that assumes that language-only locale codes (i.e. locale IDs without ‘_’or ‘-’ ) can only have a parent of “root” may now fail.

Node.js 16.9.0 did not update ICU, but it did update V8 -- I suspect there's a V8 change somewhere that handles a non-"root" parent.

@richardlau
Copy link
Member

@targos
Copy link
Member

targos commented Dec 8, 2022

It seems safe to backport. FWIW this part of the code is still the same in V8's main branch.

@richardlau
Copy link
Member

Opened #45785.

@synchronos-t
Copy link
Author

synchronos-t commented Dec 8, 2022

Node.js 14.17.1 updated to ICU 69.1. This is likely related to https://icu.unicode.org/design/norwegian-locales-changes-in-v39.

“nb” and “nn” inherit from a prent locale “no”. This is the first case in which a language-only locale code has a parent other than “root”. Code that assumes that language-only locale codes (i.e. locale IDs without ‘_’or ‘-’ ) can only have a parent of “root” may now fail.

I wonder if that is the cause why it only affected the nb and not nn, if they both inherit from the no locale.

richardlau added a commit that referenced this issue Dec 8, 2022
Original commit message:

    [Intl] Fix nb / no fallback

    ICU 69 moved content of nb resources to no and let
    nb fallback to no. This break our original design of checking
    locale availability. Hard wire to check on no if nb fail for now
    until we come out with a better fix.

    Bug: chromium:1215606
    Change-Id: I831529d29590cc643ee0109fb2ce8948dac75613
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3068010
    Commit-Queue: Frank Tang <ftang@chromium.org>
    Reviewed-by: Shu-yu Guo <syg@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#76044}

Refs: v8/v8@d2db7fa
PR-URL: #45785
Fixes: #45784
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
@bnoordhuis
Copy link
Member

Fixed in v14.21.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants