Skip to content

Commit

Permalink
Use navigator.languages if available to determine default locale.
Browse files Browse the repository at this point in the history
Fixes #70
  • Loading branch information
JCEmmons committed Oct 30, 2014
1 parent 8cc520b commit 04acd7b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions impl/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,18 @@ define(["./List", "./Record",
* @private
*/
DefaultLocale : function () {
var result;
var result = null;
var global = (function () {return this; })();
var navigator = global.navigator;
if (navigator && this.isStructurallyValidLanguageTag(navigator.language)) {
if (navigator && navigator.languages) {
var languageList = navigator.languages.slice(0);
while (!result && languageList.length > 0) {
var tag = languageList.shift();
result = this.BestFitAvailableLocale(this.availableLocalesList, this
.CanonicalizeLanguageTag(tag));
}
}
if (!result && navigator && this.isStructurallyValidLanguageTag(navigator.language)) {
result = this.BestFitAvailableLocale(this.availableLocalesList, this
.CanonicalizeLanguageTag(navigator.language));
}
Expand Down

0 comments on commit 04acd7b

Please sign in to comment.