dont set default locale in user.ui and use first browser locale by default if available and fall back to site default after that, fixes #1578; load locale from unjoined json files in debug mode

This commit is contained in:
j 2013-07-17 10:24:22 +00:00
commit 5489823a61
7 changed files with 29 additions and 10 deletions

View file

@ -1734,11 +1734,23 @@ pandora.selectList = function() {
};
pandora.setLocale = function(locale, callback) {
Ox.setLocale(
locale,
locale && locale != 'en' ? '/static/json/locale.' + locale + '.json' : null,
callback
);
var url;
// language from http header might not be supported,
// fall back to site default
if (Ox.isUndefined(Ox.LOCALE_NAMES[locale])) {
locale = pandora.site.site.locale;
}
if (locale != 'en') {
if (pandora.localStorage('enableDebugMode')) {
url = [
'/static/json/locale.pandora.' + locale + '.json',
'/static/json/locale.' + pandora.site.site.id + '.' + locale + '.json',
];
} else {
url = '/static/json/locale.' + locale + '.json'
}
}
Ox.setLocale(locale, url, callback);
};
pandora.unloadWindow = function() {