Closed martinmasse closed 7 years ago
Hi,
I was able to setup localization with SystemJS by wrapping System.import as follow.
$(function () { $.when( $.getJSON("js/localization/fr-ca/ca-gregorian.json"), $.getJSON("js/localization/fr-ca/numbers.json"), $.getJSON("js/localization/fr-ca/currencies.json"), $.getJSON("node_modules/cldr-data/supplemental/likelySubtags.json"), $.getJSON("node_modules/cldr-data/supplemental/timeData.json"), $.getJSON("node_modules/cldr-data/supplemental/weekData.json"), $.getJSON("node_modules/cldr-data/supplemental/currencyData.json"), $.getJSON("node_modules/cldr-data/supplemental/numberingSystems.json") ).then(function () { //The following code converts the got results into an array return [].slice.apply(arguments, [0]).map(function (result) { return result[0]; }); }).then( Globalize.load //loads data held in each array item to Globalize ).then(function () { var deferred = $.Deferred();
$.get("js/localization/dx.all.fr.json").then(function (data) { Globalize.loadMessages(data); Globalize.locale("fr-CA"); System.import('app').catch(function (err) { console.error(err); }); deferred.resolve(); }); return deferred.promise(); }) });
How can I do this if I use WebPack??? Where can I inject this code???
Thanks
Please refer to this example. Also, please check out this comment for some extra information.
Hi,
I was able to setup localization with SystemJS by wrapping System.import as follow.
$(function () { $.when( $.getJSON("js/localization/fr-ca/ca-gregorian.json"), $.getJSON("js/localization/fr-ca/numbers.json"), $.getJSON("js/localization/fr-ca/currencies.json"), $.getJSON("node_modules/cldr-data/supplemental/likelySubtags.json"), $.getJSON("node_modules/cldr-data/supplemental/timeData.json"), $.getJSON("node_modules/cldr-data/supplemental/weekData.json"), $.getJSON("node_modules/cldr-data/supplemental/currencyData.json"), $.getJSON("node_modules/cldr-data/supplemental/numberingSystems.json") ).then(function () { //The following code converts the got results into an array return [].slice.apply(arguments, [0]).map(function (result) { return result[0]; }); }).then( Globalize.load //loads data held in each array item to Globalize ).then(function () { var deferred = $.Deferred();
How can I do this if I use WebPack??? Where can I inject this code???
Thanks