-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Adopt globalize for i18n #1494
Comments
My first question would be why? While globalize is a great project, there is already an EcmaScript standard Intl interface that is supported in V8 based on ICU and the Intl stuff has already been switched on in Node v0.12.x. @srl295 has gone to significant lengths to minimize the default footprint of ICU and to modularize the data to make it possible to use npm to install the additional CLDR/ICU data files. Globalize is fantastic to supplement the functionality currently not supported by the EcmaScript Intl API but developers can already make use of that without io.js or node.js having to do anything in core. |
👍 Some remarks:
|
But it has deliberately not been turned on in io.js, because we weren't happy with the solution.
Although it is now possible to fetch those data files with npm, it hasn't really been modularized. Node needs to be started up with particular command line arguments (or with an environment variable set), by which the ICU data that will be used globally is specified. It's not possible for a module that needs ICU data to load it on demand. |
Ok, that's fine. Additional modularization is something that can be explored, but let's not discount the work that's been done so far. Incremental improvement is A Good Thing. So, right now, for very important performance reasons, ICU does a one time initialization of it's data files and memory maps everything. The downside, as you point out, is that the data files have to be specified at start up time, with modules getting whatever they get from the environment. So let's explore what this "load on demand" would mean... Globalize currently depends on 'cldr-data', when you
Only once everything is downloaded, can you load it in a "modular" way by cherry picking exactly which downloaded files to load into memory. Regardless of what you end up pulling in using |
Further, it's not exactly clear how the "load on demand" model would actually work here. Globalize is written the way it is in order to keep from having to load the entire CLDR dataset on a client-side connection. However, when used on the server side in node, we end up downloading the entire set anyway as part of the |
Nope. Globalize uses whatever CLDR source you provide, not necessarily from |
Globalize needs CLDR content to function properly, although it doesn't embed or host such content. Instead, Globalize empowers developers to load CLDR data the way they want. Vanilla CLDR in its official JSON format (no pre-processing) is expected to be provided (via I'm happy to answer to any Globalize question. Please, just let me know if I can help with something. |
Ok, that's fair (and thanks for that reminder @rxaviers ). Like I said, better modularization in ICU is definitely something that can be worked on. I'm just not exactly clear what the overall benefit would be by having io.js "adopt" globalize vs. incrementally improving the icu based solution, particularly given the V8 support that already exists and given that there's absolutely nothing stopping developers from already using globalize if they want. In other words, why would io.js need to do anything in core with regards to globalize? |
(btw, my apologies for misspeaking... I'd actually forgotten that cldr-data was a peer-dependency) |
It seems that it would require some serious work to libicu such that multiple "instances" can be constructed (as opposed to there being one singleton instance). Are there any plans to that end? A quick search of the website/mailing list didn't turn up anything (there was some discussion around ICU4J but not for the c++ implementation). |
@srl295 would be able to say for certain how much work would be involved
|
It looks like there's a lot of ecosystem work going around i18n.
With so much going on I think it's a bad idea to "pick one." It would probably be best to find a way for developers to bind the library of their choice to Intl in userland. I don't know how doable this is but maybe it's time we ping the v8 team about this. |
Definitely, there are. A little more about that farm in https://github.com/rxaviers/javascript-globalization/ @mikeal, please could you describe in a little more detail which i18n support does io.js need? |
Converging is going to require us to turn on some sort on Intl by default, and since we already have most of that, just not default, and that's where work is going to be, I'm going to close out and defer to #26. Re-open if necessary though. |
The jQuery team along with several other people working on i18n an JS standards have put together a new library for i18n.
https://github.com/jquery/globalize
We've had a lot of conversations in the TC about how taking on ICU is "too big" for core and that we would prefer a more modular approach that allowed us to load language support modularly but nobody has written this yet. Globalize would appear to be at least part of this solution.
Thoughts?
The text was updated successfully, but these errors were encountered: