Commit 9f975c79 authored by JC Brand's avatar JC Brand

`preferred_locale` might be a JSON string, not an object

parent 9faf9c3d
...@@ -459,12 +459,12 @@ ...@@ -459,12 +459,12 @@
utils.getLocale = function (preferred_locale, isSupportedByLibrary) { utils.getLocale = function (preferred_locale, isSupportedByLibrary) {
if (isSupportedByLibrary(preferred_locale)) { if (isSupportedByLibrary(preferred_locale)) {
return preferred_locale; return preferred_locale;
} else if (_.isObject(preferred_locale)) { }
try { try {
return preferred_locale.locale_data.converse[""].lang; var obj = window.JSON.parse(preferred_locale);
} catch (e) { return obj.locale_data.converse[""].lang;
console.log(e); } catch (e) {
} console.log(e);
} }
return utils.detectLocale(isSupportedByLibrary) || 'en'; return utils.detectLocale(isSupportedByLibrary) || 'en';
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment