Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Localization and WebPack #155

Closed
martinmasse opened this issue Oct 14, 2016 · 1 comment
Closed

Localization and WebPack #155

martinmasse opened this issue Oct 14, 2016 · 1 comment
Assignees
Labels

Comments

@martinmasse
Copy link

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

@GoshaFighten GoshaFighten self-assigned this Oct 21, 2016
@dxbykov
Copy link
Contributor

dxbykov commented Nov 30, 2016

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

@dxbykov dxbykov closed this as completed Nov 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants