Created
May 29, 2019 12:48
-
-
Save theodesp/14c9703c0629665a1f8a26e23bba8115 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
(function($) { | |
$.when( | |
$.get( 'js/vendor/cldr/en/ca-gregorian.json' ), | |
$.get( 'js/vendor/cldr/en/currencies.json' ), | |
$.get( 'js/vendor/cldr/en/numbers.json' ), | |
$.get( 'js/vendor/cldr/en/units.json' ), | |
$.get( 'js/vendor/cldr/supplemental/plurals.json' ), | |
$.get( 'js/vendor/cldr/supplemental/timeData.json' ), | |
$.get( 'js/vendor/cldr/supplemental/weekData.json' ), | |
$.get( 'js/vendor/cldr/supplemental/likelySubtags.json' ) | |
).then(function() { | |
// Normalize $.get results, we only need the JSON, not the request statuses. | |
return [].slice.apply( arguments, [ 0 ] ).map(function( result ) { | |
return result[ 0 ]; | |
}); | |
}).then(Globalize.load).then(function() { | |
const locale = new LocaleProvider(detectLocale()); | |
locale.onChangeLocale((tag)=> { | |
console.log('Locale Changed to', tag); | |
loadTranslationsFor(tag).then(() => { | |
const current = Globalize(tag); | |
console.log(current.messageFormatter( 'like' )(10)); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment