Merge pull request #2199 from matakuka/noBrowserLanguage

sets language to en if no browser language is set
This commit is contained in:
Norman Jäckel 2016-07-11 14:19:14 +02:00 committed by GitHub
commit 2627724c55

View File

@ -106,10 +106,14 @@ angular.module('OpenSlidesApp.core', [
// get detected browser language code // get detected browser language code
getBrowserLanguage: function () { getBrowserLanguage: function () {
var lang = navigator.language || navigator.userLanguage; var lang = navigator.language || navigator.userLanguage;
if (lang.indexOf('-') !== -1) if (!navigator.language && !navigator.userLanguage) {
lang = lang.split('-')[0]; lang = 'en';
if (lang.indexOf('_') !== -1) } else {
lang = lang.split('_')[0]; if (lang.indexOf('-') !== -1)
lang = lang.split('-')[0];
if (lang.indexOf('_') !== -1)
lang = lang.split('_')[0];
}
return lang; return lang;
}, },
// set current language and return updated languages object array // set current language and return updated languages object array