Last active
August 29, 2015 14:01
-
-
Save rxaviers/1de0f51c40542895b020 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a new directory and copy `index.html` into it. Then, enter the directory and run: | |
``` | |
bower install jquery#1.x cldr#1.x | |
wget http://www.unicode.org/Public/cldr/latest/json.zip | |
unzip json.zip -d cldr | |
python -m SimpleHTTPServer | |
``` | |
Point your browser to `localhost:8000` and see the output on your javascript console. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
</head> | |
<body> | |
<script src="bower_components/jquery/dist/jquery.js"></script> | |
<script src="bower_components/cldrjs/dist/cldr.js"></script> | |
<script src="bower_components/cldrjs/dist/cldr/supplemental.js"></script> | |
<script src="bower_components/globalize/dist/globalize.js"></script> | |
<script src="bower_components/globalize/dist/globalize/date.js"></script> | |
<script src="bower_components/globalize/dist/globalize/number.js"></script> | |
<script> | |
$.when( | |
$.get( "cldr/main/en/ca-gregorian.json", Globalize.load ), | |
$.get( "cldr/main/en/numbers.json", Globalize.load ), | |
$.get( "cldr/supplemental/likelySubtags.json", Globalize.load ), | |
$.get( "cldr/supplemental/timeData.json", Globalize.load ), | |
$.get( "cldr/supplemental/weekData.json", Globalize.load ) | |
).done(function() { | |
Globalize.locale( "en" ); | |
console.log( Globalize.formatDate( new Date(), { datetime: "medium" } ) ); | |
console.log( Globalize.formatNumber( 12345 ) ); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment