Tweak logic used by UI to detect language

Chromium and WebKit based browsers have the window.navigator.languages attribute, which is an ordered array of preferred languages as configured in the browser’s settings.

Although changing the language in Chrome results in an Accept-Language header being added to requests, window.navigator.language still returns the language specified by the OS.

I’ve tested this with Firefox, Chrome, IE 11, and Edge.

Connect #5360
This commit is contained in:
Shane McDonald 2017-02-14 15:37:52 -05:00
parent 8df1088c99
commit be686e0acc

View File

@ -19,7 +19,8 @@ export default
.factory('I18NInit', ['$window', 'gettextCatalog',
function ($window, gettextCatalog) {
return function() {
var langInfo = $window.navigator.language ||
var langInfo = ($window.navigator.languages || [])[0] ||
$window.navigator.language ||
$window.navigator.userLanguage;
var langUrl = langInfo.replace('-', '_');
//gettextCatalog.debug = true;