Browse Source

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
master
Roman Anasal 10 years ago
parent
commit
4f317b4282
  1. 17
      app/js/init.js

17
app/js/init.js

@ -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();
}); });
}); });
})(); })();

Loading…
Cancel
Save