Closed cfjedimaster closed 9 years ago
Thanks. But, it's a duplicate of #428 and it has been fixed on master
already.
PS: We're going to move documentation to a separate repo and publish it on globalizejs.com, then fixes like this can go live immediately.
Glad to hear. I have to say that I'm having a rough time grokking the library so any doc improvements would be appreciated. :)
On Mon, May 11, 2015 at 11:52 AM, Jörn Zaefferer notifications@github.com wrote:
PS: We're going to move documentation to a separate repo and publish it on globalizejs.com, then fixes like this can go live immediately.
— Reply to this email directly or view it on GitHub https://github.com/jquery/globalize/issues/448#issuecomment-100977019.
Raymond Camden, Developer Advocate for MobileFirst at IBM
Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden
Just let us know on any questions. Suggestions for improvement are welcome.
If I can make it specific I will, but its more of a general confusion I guess. I get why cldr is separated, but it itself has so many options in terms of how to use it that I'm feeling lost.
As an example. I want to build a web app that will sniff the user's locale and display numbers in the right format. So it seems as if I need to do the following:
1) Get the more current cldr.js files (4 of them) 2) I then need... um.. a cldr "structure"? This part confuses me the most I think. It seems like I need a JSON packet from CLDR too. There are packets for different features and different locales. So I need to first figure out what I'm doing (in this case, just numbers) and then my locales (so lets say English, French, German). So I have to hunt down those particular JSON packets and either paste them in or load them async. 3) Finally I use the Globalize API itself - which frankly seems ok.
I guess it's just 1-2 that's really feeling weird to me now.
On Mon, May 11, 2015 at 12:23 PM, Rafael Xavier de Souza < notifications@github.com> wrote:
Just let us know on any questions. Suggestions for improvement are welcome.
— Reply to this email directly or view it on GitHub https://github.com/jquery/globalize/issues/448#issuecomment-100984202.
Raymond Camden, Developer Advocate for MobileFirst at IBM
Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden
Have you seen our Hello World examples (at https://github.com/jquery/globalize#usage)? They are not as complete as a whole web app example would be (and we definitely should work on one), but it could help you to understand some of your questions.
cldr.js is a Globalize dependency. If you are building your web app using AMD or CJS, you probably won't need to worry about it (note, you don't use cldr.js directly). If you are managing your dependencies manually, see the plain JavaScript example.
About using Globalize, all you need to do is to provide enough CLDR data (i18n content), so it works correctly in the locales you need. For example, make sure to load the required JSON data for the number module (details in https://github.com/jquery/globalize/#2-cldr-content) and replace locale
by en
(for English as spoken in the US), fr
(for French as spoken in France), and de
(for German as spoken in Germany).
If this isn't clear, just let me know (by also explaining more your case, for example, how you will sniff the user's locale?). Also feel free to ping me on IRC (details) and I will be happy to assist you further.
Ok, so let's focus on:
"all you need to do is to provide enough CLDR data"
Looking at the link, and focusing on numbers, it says:
"cldr/main/locale/numbers.json cldr/supplemental/numberingSystems.json"
But - the example app uses a hard coded set of data inside the index.html file. So an end user either loads those files via XHR, or pastes in the content?
It would be nice if the "plain javascript" version demonstrated this. Also, I assume then that if I want to support 2 langs, X and Y, I'd need:
cldr/main/X/numbers.json cldr/main/Y/numbers.json cldr/supplemental/numberingSystems.json
Right?
On Mon, May 11, 2015 at 12:57 PM, Rafael Xavier de Souza < notifications@github.com> wrote:
Have you seen our Hello World examples (at https://github.com/jquery/globalize#usage)? They are not as complete as a whole web app example would be (and we definitely should work on one), but it could help you understanding some of your questions.
cldr.js is a Globalize dependency. If you are building your web app using AMD or CJS, you probably won't need to worry about it (note, you don't use cldr.js directly). If you are managing your dependencies manually see the plain JavaScript example.
For using Globalize, all you need to do is to provide enough CLDR data (i18n content), so it works correctly in the locales you need. For example, make sure to load the required JSON data for the number module (details in https://github.com/jquery/globalize/#2-cldr-content) and replace locale by en (for English as spoken in the US), fr (for French as spoken in France), and de (for German as spoken in Germany).
If this isn't clear, just let me know (by also explaining more your case, for example, how you will sniff the user's locale?). Also feel free to ping me on IRC (details http://irc.jquery.org/) and I will be happy to assist you further.
— Reply to this email directly or view it on GitHub https://github.com/jquery/globalize/issues/448#issuecomment-100998723.
Raymond Camden, Developer Advocate for MobileFirst at IBM
Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden
Looking at the link, and focusing on numbers, it says:
"cldr/main/locale/numbers.json cldr/supplemental/numberingSystems.json"
Yes and you also need to load cldr/supplemental/likelySubtags.json
(the dependency for the core module).
But - the example app uses a hard coded set of data inside the index.html file.
The plain JavaScript example simply hard codes it to demonstrate that plain JSON is what you need to provide for Globalize. But, note there are other examples as well. For instance, one using AMD plugins and another using commonJS require
. You can use any loading mechanism you want in order to get the JSON.
Using XHR or pasting it manually are two options. But, not the only two. You can use a build tool (e.g., r.js or browserify) and generate a bundle of your app including the necessary CLDR data.
I assume then that if I want to support 2 langs, X and Y, I'd need:
cldr/main/X/numbers.json cldr/main/Y/numbers.json cldr/supplemental/numberingSystems.json
Correct. If you need to support X and Y simultaneously, you need to load both. Otherwise, load the one you will use.
I guess it would be nice then to see a full example of going from:
"I need numbers for locales X and Y" to "here are the files you gather". Then followed up "Oh, now we need to do dates." and "Here is what I added..."
I don't use browserify or require.js very often, so a 'manual' demonstration would be helpful for me, and probably others.
On Mon, May 11, 2015 at 3:07 PM, Rafael Xavier de Souza < notifications@github.com> wrote:
Looking at the link, and focusing on numbers, it says:
"cldr/main/locale/numbers.json cldr/supplemental/numberingSystems.json"
Yes and you also need to load cldr/supplemental/likelySubtags.json (the dependency for the core module).
But - the example app uses a hard coded set of data inside the index.html file.
The plain JavaScript example simply hard codes it to demonstrate that plain JSON is what you need to provide for Globalize. But, note there are other examples as well. For instance, one using AMD plugins and another using commonJS require. You can use any loading mechanism you want in order to get the JSON.
Using XHR or pasting it manually are two options. But, not the only two. You can use a build tool (e.g., r.js or browserify) and generate a bundle of your app including the necessary CLDR data.
I assume then that if I want to support 2 langs, X and Y, I'd need:
cldr/main/X/numbers.json cldr/main/Y/numbers.json cldr/supplemental/numberingSystems.json
Correct. If you need to support X and Y simultaneously, you need to load both. Otherwise, load the one you will use.
— Reply to this email directly or view it on GitHub https://github.com/jquery/globalize/issues/448#issuecomment-101032962.
Raymond Camden, Developer Advocate for MobileFirst at IBM
Email : raymondcamden@gmail.com Blog : www.raymondcamden.com Twitter: raymondcamden
The top two links here, https://github.com/jquery/globalize/blob/1.0.0/doc/cldr.md, for getting the JSON data goes to a 404.