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 @@
utils.getLocale = function (preferred_locale, isSupportedByLibrary) {
if (isSupportedByLibrary(preferred_locale)) {
return preferred_locale;
} else if (_.isObject(preferred_locale)) {
try {
return preferred_locale.locale_data.converse[""].lang;
} catch (e) {
console.log(e);
}
}
try {
var obj = window.JSON.parse(preferred_locale);
return obj.locale_data.converse[""].lang;
} catch (e) {
console.log(e);
}
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