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

Delta Between Two Patch Sets: safari/ext/common.js

Issue 4871895371481088: Convert region code to uppercase when generating translation file URL on Safari (Closed)
Left Patch Set: Added comment regarding dropping the remaining components Created April 10, 2014, 10:11 a.m.
Right Patch Set: Corrected wrong assumptions in comment Created April 10, 2014, 10:33 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 /* I18n */ 78 /* I18n */
79 79
80 var localeCandidates = null; 80 var localeCandidates = null;
81 var uiLocale; 81 var uiLocale;
82 82
83 var getLocaleCandidates = function() 83 var getLocaleCandidates = function()
84 { 84 {
85 var candidates = []; 85 var candidates = [];
86 var defaultLocale = "en_US"; 86 var defaultLocale = "en_US";
87 87
88 // e.g. "en-us" -> "en", "us", if there are multiple dashes, the part 88 // e.g. "ja-jp-mac" -> "ja", "jp", note that the part after the second
89 // after the second dash will be dropped, but that case doesn't exist 89 // dash is dropped, since we only support language and region
Wladimir Palant 2014/04/10 10:17:48 Nit: use "ja-jp-mac" as example? That case does ex
Sebastian Noack 2014/04/10 10:33:28 Done.
90 var [language, region] = navigator.language.split("-"); 90 var [language, region] = navigator.language.split("-");
91 91
92 if (region) 92 if (region)
93 candidates.push(language + "_" + region.toUpperCase()); 93 candidates.push(language + "_" + region.toUpperCase());
94 94
95 candidates.push(language); 95 candidates.push(language);
96 96
97 if (candidates.indexOf(defaultLocale) == -1) 97 if (candidates.indexOf(defaultLocale) == -1)
98 candidates.push(defaultLocale); 98 candidates.push(defaultLocale);
99 99
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 }; 180 };
181 181
182 182
183 /* Utils */ 183 /* Utils */
184 184
185 ext.getURL = function(path) 185 ext.getURL = function(path)
186 { 186 {
187 return safari.extension.baseURI + path; 187 return safari.extension.baseURI + path;
188 }; 188 };
189 })(); 189 })();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld