Skip to content

Commit

Permalink
Settings: Fall back to language only when locale is not found.
Browse files Browse the repository at this point in the history
Navigator.language can return either a language only ('en') or a full
locale ('en-US'). If a locale is not found ('ru-RU'), then fall back to
using only the language ('ru').

Bug: 922088
Change-Id: I215071e55a9a01a97348491603a4bdabe739ff87
Reviewed-on: https://chromium-review.googlesource.com/c/1460479
Reviewed-by: Esmael El-Moslimany <aee@chromium.org>
Commit-Queue: Hector Carmona <hcarmona@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630493}
  • Loading branch information
hcarmona authored and Commit Bot committed Feb 8, 2019
1 parent d864f75 commit 66392f1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,10 @@ Polymer({
* @return {!chrome.languageSettingsPrivate.Language|undefined}
*/
getLanguage: function(languageCode) {
return this.supportedLanguageMap_.get(languageCode);
// If a languageCode is not found, try language without location.
return this.supportedLanguageMap_.get(languageCode) ||
this.supportedLanguageMap_.get(
this.getLanguageCodeWithoutRegion(languageCode));
},

/**
Expand Down

0 comments on commit 66392f1

Please sign in to comment.