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

Delta Between Two Patch Sets: polyfill.js

Issue 29573083: Issue 5028 - Use browser namespace (Closed) Base URL: https://hg.adblockplus.org/adblockplusui/
Left Patch Set: Remove check for window.browser Created Oct. 13, 2017, 4:59 a.m.
Right Patch Set: Add polyfill.js to README.md Created Oct. 17, 2017, 12:35 p.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 | « mobile-options.js ('k') | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 "use strict"; 18 "use strict";
19 19
20 (function() 20 (function()
21 { 21 {
22 window.browser = {}; 22 window.browser = {};
Sebastian Noack 2017/10/13 21:39:23 Nit: Perhaps we should just define the "browser" o
Manish Jethani 2017/10/13 22:30:24 There will be more polyfills in this file (see htt
23 23
24 /* I18n */ 24 /* I18n */
25 25
26 let getLocaleCandidates = function(selectedLocale) 26 let getLocaleCandidates = function(selectedLocale)
27 { 27 {
28 let candidates = []; 28 let candidates = [];
29 let defaultLocale = "en-US"; 29 let defaultLocale = "en_US";
saroyanm 2017/10/16 19:24:20 Heads-up for the rebase: There were couple of chan
Manish Jethani 2017/10/16 21:35:21 Done.
30 30
31 // e.g. "ja-jp-mac" -> "ja-JP", note that the part after the second 31 // e.g. "ja-jp-mac" -> "ja_JP", note that the part after the second
32 // dash is dropped, since we only support language and region 32 // dash is dropped, since we only support language and region
33 let parts = selectedLocale.split("-"); 33 let parts = selectedLocale.split("-");
34 let language = parts[0]; 34 let language = parts[0];
35 let region = (parts[1] || "").toUpperCase(); 35 let region = (parts[1] || "").toUpperCase();
36 36
37 if (region) 37 if (region)
38 candidates.push(language + "-" + region); 38 candidates.push(language + "_" + region);
39 39
40 candidates.push(language); 40 candidates.push(language);
41 41
42 if (candidates.indexOf(defaultLocale) == -1) 42 if (candidates.indexOf(defaultLocale) == -1)
43 candidates.push(defaultLocale); 43 candidates.push(defaultLocale);
44 44
45 return candidates; 45 return candidates;
46 }; 46 };
47 47
48 let selectedLocale = window.navigator.language; 48 let selectedLocale = window.navigator.language;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (locales.length == 0) 131 if (locales.length == 0)
132 return ""; 132 return "";
133 133
134 let locale = locales.shift(); 134 let locale = locales.shift();
135 readCatalog(locale, "common.json"); 135 readCatalog(locale, "common.json");
136 readCatalog(locale, catalogFile); 136 readCatalog(locale, catalogFile);
137 } 137 }
138 } 138 }
139 }; 139 };
140 }()); 140 }());
LEFTRIGHT

Powered by Google App Engine
This is Rietveld