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