You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I failed to run basic-globalize-compiler example (it seems that some points are missed from readme), but nevertheless I have a question: what about compiling data for all locales?
Example shows a situation when we know the locale (en), but what if locale is defined dynamically in runtime and we do not know it before?
The text was updated successfully, but these errors were encountered:
You can iterate over the list of all locales from the cldr-data module and compile formatters for all locales. I did this using the grunt task below. Then during runtime you will need to use a script loader to load the right formatter when the locale is changed.
grunt.registerTask('generate:formatters', function() {
var globalizeCompiler = require('globalize-compiler');
var fs = require('fs');
var cldr = require('cldr-data');
var extracts = ['app/formatters/formatters-template.js'].map(function(input) {
return globalizeCompiler.extract(input);
});
for (var i = 0; i < cldr.availableLocales.length; i++) {
var locale = cldr.availableLocales[i];
var bundle = globalizeCompiler.compileExtracts({
defaultLocale: locale,
extracts: extracts
});
fs.writeFileSync('app/formatters/generated/formatters-' + locale + '.js', bundle);
}
});
I failed to run basic-globalize-compiler example (it seems that some points are missed from readme), but nevertheless I have a question: what about compiling data for all locales?
Example shows a situation when we know the locale (en), but what if locale is defined dynamically in runtime and we do not know it before?
The text was updated successfully, but these errors were encountered: