-
Notifications
You must be signed in to change notification settings - Fork 30
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
A simple example #6
Comments
Hi @yudao, Thanks for your interest. Good question. Basically, it's this: Example of embedding CLDR JSON data: <script>
Cldr.load({
main: {
en: {
...
}
},
supplemental: {
likelySubtags: {
...
},
timeDate: {
...
},
weekData: {
...
}
}
});
</script> Example of loading it dynamically: <script src="jquery.js"></script>
<script>
$.get( "cldr/en/ca-gregorian.json", Globalize.load );
$.get( "cldr/supplemental/likelySubtags.json", Globalize.load );
$.get( "cldr/supplemental/timeData.json", Globalize.load );
$.get( "cldr/supplemental/weekData.json", Globalize.load );
</script> Example on AMD: (also see our functional tests) define([
"cldr",
"json!fixtures/cldr/main/en/ca-gregorian.json",
"json!fixtures/cldr/supplemental/likelySubtags.json",
"json!fixtures/cldr/supplemental/timeData.json",
"json!fixtures/cldr/supplemental/weekData.json"
], function( Cldr, enCaGregorian, likelySubtags, timeData, weekData ) {
Cldr.load( enCaGregorian );
Cldr.load( likelySubtags );
Cldr.load( timeData );
Cldr.load( weekData );
}); Example on node.js:
Note that cldr does not fetch the data for you. But, you can use any other method to accomplish that, then feed Cldr. Please, just let me know in any questions. Action item:
|
Thanks a lot @rxaviers! |
You're welcome! I will leave this opened until README is updated. |
Hi,
Firstly, thanks to the work accomplished.
I'm trying to test your API and it's difficult to understand how to load JSON data.
In fact, I've downloaded the generated JSON files (http://www.unicode.org/repos/cldr-aux/json/24/), put in a directory called "cldr" in my public directory.
There, I'm trying to implements some of your examples, like:
But my first question is how we can tell to cldr runtime script to get the JSON files in the right directory?
I prefer to inform you that I'm using Node + Brunch + Bower.
Thanks a lot.
The text was updated successfully, but these errors were encountered: