SSR - Possible bug with Intl.DisplayNames of type region
Hello !
I face an issue with Intl on SSR.
When using
new Intl.DisplayNames("en", { type: "region" })
and then console.log(regionNames.of("fr"))
I get a different result on the server comparing to the client, as shown in the screenshot.
Note that it works as intended with the types language
and currency
.
You can test it yourself by cloning this repo : https://github.com/Kheuval/intl-reproduction
Thanks for your help !GitHub
GitHub - Kheuval/intl-reproduction
Contribute to Kheuval/intl-reproduction development by creating an account on GitHub.
2 Replies
Sometimes it depends on the node version installed and also how the installed version is compiled. More commonly, node is shipped with a small data set for internationalisation features (explained here https://nodejs.org/docs/latest-v22.x/api/intl.html).
What is the output if you run
node -p "process.versions.icu"
?Ok thanks for the explanation, the output for this command is
73.2
.
To be more specific, I tested it on 2 environments :
- Node v20.10.0 installed on my machine through nvm
- Node v20.10.0 inside a docker container with the image node:20.10.0
The problem occurs in both environments and when I run node -p 'process.config.variables.icu_small'
the output is false
, hinting that the full-icu
package is in use...
At this point I don't really know if the issue comes from my environment(s) or from Nuxt itself :/
Do you have any idea ? 🙂