From be686e0accb9e8facc652a559b1fb39a8508c97d Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Tue, 14 Feb 2017 15:37:52 -0500 Subject: [PATCH] Tweak logic used by UI to detect language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- awx/ui/client/src/i18n.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/ui/client/src/i18n.js b/awx/ui/client/src/i18n.js index b37d05a8c0..d024f01c7d 100644 --- a/awx/ui/client/src/i18n.js +++ b/awx/ui/client/src/i18n.js @@ -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;