[Pkg-javascript-commits] [dojo] 90/149: Correct reading of browser locale

David Prévot taffit at moszumanska.debian.org
Sat Feb 27 03:13:51 UTC 2016


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository dojo.

commit 31977b8870a1b3b3a618578450e63d211f594fdc
Author: Martin Doyle <MartinDoyleUK at users.noreply.github.com>
Date:   Thu Oct 1 08:50:20 2015 +0100

    Correct reading of browser locale
    
    Correct the reading of the browser locale, to avoid situations where the language
    is taken from the locale from which the browser downloaded, rather than the user's
    chosen language settings.  A common example is where Chrome returns en-US for users
    in the UK where the navigator.languages[0] would actually return en-GB instead.
    
    Fixes #18722.
---
 _base/config.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/_base/config.js b/_base/config.js
index 56b71f4..a91e1de 100644
--- a/_base/config.js
+++ b/_base/config.js
@@ -172,8 +172,8 @@ return {
 	}
 
 	if(!result.locale && typeof navigator != "undefined"){
-		// Default locale for browsers.
-		var language = (navigator.language || navigator.userLanguage);
+		// Default locale for browsers (ensure it's read from user-settings not download locale).
+		var language = navigator.languages ? navigator.languages[0] : (navigator.language || navigator.userLanguage);
 		if(language){
 			result.locale = language.toLowerCase();
 		}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list