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

[I18n] Integrate full-icu module #20288

Closed
maksim-tolo opened this issue Jun 28, 2018 · 8 comments
Closed

[I18n] Integrate full-icu module #20288

maksim-tolo opened this issue Jun 28, 2018 · 8 comments
Labels
discuss Project:i18n Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@maksim-tolo
Copy link
Contributor

By default Node.js is installed with small-icu flag, which means that Intl supports only English locale. In order to add full ICU data, we have to add full-icu module to the project dependencies and set NODE_ICU_DATA environment variable to ./node_modules/full-icu before starting node.js process. Here you can find more details https://nodejs.org/api/intl.html. It affects only server usage of i18n.

@maksim-tolo maksim-tolo added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Project:i18n labels Jun 28, 2018
@maksim-tolo
Copy link
Contributor Author

#19555

@yankouskia yankouskia self-assigned this Jun 28, 2018
@azasypkin
Copy link
Member

It'd be great to know all the options we have so that we can make an informed decision. Also I can think of the following question that'd be great to get answers for:

  • What issues exactly we'll have with @kbn/i18n + small-icu?
  • Can we provide missing ICU stuff at runtime?
  • How does that affect size of distributive?
  • Can we provide just a subset of ICU data for selected locales?

@yankouskia
Copy link

yankouskia commented Jun 28, 2018

@azasypkin All detailed information can be found here Node.js doc.
Briefly:

  1. small-icu supports only English locale (Intl.NumberFormat, Intl.DateTimeFormat formattings will work correctly only with en locale).
  2. There is only ability to use full-icu module and run application like node --icu-data-dir=./node_modules/full-icu app.js. (We can also think about wrapping server into docker container).
    Moreover, we could create custom wrappers in our i18n plugin under Moment.js, it has own locales for formatting dates and times. And use Numeral-js in the same way for NumberFormat. But need investigate this approach and available locales in mentioned packages.
  3. Currently node build with full-icu increases bundle size on approximately 40%.
  4. Not sure for now.

Added:
There is Intl polyfill, which we could use in Node environment on runtime.

@bmcconaghy
Copy link
Contributor

Echoing the question above, would like to explore only including a subset of the icu data. Most locales will not have full support for a long time so it would not make sense to load the icu data for them.

@yankouskia
Copy link

yankouskia commented Jul 7, 2018

@bmcconaghy If we say about client side, then for sure we should do it, you are right.
In scope of Node implementation we are going to use polyfill, which has translations out of the box and from my perspective it's not a problem for server-side.

Here is part of code for supporting it

@wylieconlon
Copy link
Contributor

Node 13 already contains full ICU information, but since it's an odd-numbered version it won't get LTS releases. We will likely upgrade to Node 14 once it's released later this year, and get this automatically.

@lukeelmers
Copy link
Member

@Bamieh Now that we've upgraded to Node 14, can we close this issue?

@Bamieh
Copy link
Member

Bamieh commented Jun 27, 2021

@lukeelmers yes node is now built with full icu (--with-intl=full-icu) by default. Closing as resolved.

@Bamieh Bamieh closed this as completed Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Project:i18n Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

8 participants