[Pkg-javascript-commits] [dojo] 32/58: Correct reading of browser locale

David Prévot taffit at moszumanska.debian.org
Thu Mar 24 04:28:26 UTC 2016


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

taffit pushed a commit to annotated tag 1.10.5
in repository dojo.

commit 1236691a453b17a43fc85900740d677e035c9cdb
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.
    
    (cherry picked from commit 31977b8870a1b3b3a618578450e63d211f594fdc)
---
 _base/config.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/_base/config.js b/_base/config.js
index 4c3b085..37fb888 100644
--- a/_base/config.js
+++ b/_base/config.js
@@ -185,8 +185,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