DevExpress / devextreme-angular

Angular UI and data visualization components
https://js.devexpress.com/Demos/
MIT License
561 stars 159 forks source link

Localization and WebPack #155

Closed martinmasse closed 7 years ago

martinmasse commented 8 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

dxbykov commented 7 years ago

Please refer to this example. Also, please check out this comment for some extra information.