fix loading of angular-locale in init.js

1. check for locale == defaultLocale for locale from ConfigStorage
2. the <script> needs to be added to the doom before setting the src
   attribute
This commit is contained in:
Roman Anasal 2014-09-19 20:09:42 +02:00
parent ace380f2bb
commit 4f317b4282

View File

@ -78,7 +78,7 @@
defaultLocale = 'en-us', defaultLocale = 'en-us',
bootReady = { bootReady = {
dom: false, dom: false,
i18n_ng: Config.I18n.locale == defaultLocale, // Already included i18n_ng: locale == defaultLocale, // Already included
i18n_messages: false, i18n_messages: false,
i18n_fallback: false i18n_fallback: false
}, },
@ -114,13 +114,12 @@
} }
if (!bootReady.i18n_ng) { if (!bootReady.i18n_ng) {
$('head').append($('<script>') $('<script>').appendTo('head')
.on('load', function() { .on('load', function() {
bootReady.i18n_ng = true; bootReady.i18n_ng = true;
checkReady(); checkReady();
}) })
.attr('src', 'vendor/angular/i18n/angular-locale_' + Config.I18n.locale + '.js') .attr('src', 'vendor/angular/i18n/angular-locale_' + Config.I18n.locale + '.js');
);
} }
$.getJSON('js/locales/' + Config.I18n.locale + '.json').success(function (json) { $.getJSON('js/locales/' + Config.I18n.locale + '.json').success(function (json) {
@ -145,4 +144,4 @@
checkReady(); checkReady();
}); });
}); });
})(); })();