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

Unified Diff: safari/ext/common.js

Issue 4793439480709120: Issue 2008 - Handle language codes without region on Safari (Closed)
Patch Set: Created Feb. 18, 2015, 8:55 a.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
@@ -102,16 +102,19 @@
// 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)
+ {
+ 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 != "ES")
+ region = "419";
+
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