Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: safari/ext/common.js

Issue 5937661852254208: Issue 1666 - Use es-419 on Safari if UI language is Spanish outside of Spain (Closed)
Patch Set: Created Dec. 5, 2014, 7:03 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: safari/ext/common.js
===================================================================
--- a/safari/ext/common.js
+++ b/safari/ext/common.js
@@ -82,12 +82,19 @@
var candidates = [];
var defaultLocale = "en_US";
- // e.g. "ja-jp-mac" -> "ja", "jp", note that the part after the second
+ // e.g. "ja-jp-mac" -> "ja_JP", note that the part after the second
// dash is dropped, since we only support language and region
var [language, region] = navigator.language.split("-");
+ region = region.toUpperCase();
+
+ // e.g. "es-AR" -> "es_419", note that we combine all dialects of
+ // Spanish outside of Spain, the same way Google Chrome does,
+ // since we use the same translations as for the Chrome extension
+ if (language == "es" && region && region != "ES")
+ region = "419";
if (region)
- candidates.push(language + "_" + region.toUpperCase());
+ candidates.push(language + "_" + region);
candidates.push(language);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld