sets language to en if no browser language is set
This commit is contained in:
parent
7a94b6511b
commit
31df629fc9
@ -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 (!navigator.language && !navigator.userLanguage) {
|
||||||
|
lang = 'en';
|
||||||
|
} else {
|
||||||
if (lang.indexOf('-') !== -1)
|
if (lang.indexOf('-') !== -1)
|
||||||
lang = lang.split('-')[0];
|
lang = lang.split('-')[0];
|
||||||
if (lang.indexOf('_') !== -1)
|
if (lang.indexOf('_') !== -1)
|
||||||
lang = lang.split('_')[0];
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user