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

Side by Side Diff: ext/common.js

Issue 29574648: Issue 5860 - options page is broken in test enviroment (Closed)
Patch Set: Addressed Sebastian's comments Created Oct. 12, 2017, 8:23 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if ("_extWrapper" in listener) 76 if ("_extWrapper" in listener)
77 window.removeEventListener("message", listener._extWrapper, false); 77 window.removeEventListener("message", listener._extWrapper, false);
78 } 78 }
79 }; 79 };
80 80
81 /* I18n */ 81 /* I18n */
82 82
83 let getLocaleCandidates = function(selectedLocale) 83 let getLocaleCandidates = function(selectedLocale)
84 { 84 {
85 let candidates = []; 85 let candidates = [];
86 let defaultLocale = "en-US"; 86 let defaultLocale = "en_US";
87 87
88 // e.g. "ja-jp-mac" -> "ja-JP", note that the part after the second 88 // e.g. "ja-jp-mac" -> "ja_JP", note that the part after the second
89 // dash is dropped, since we only support language and region 89 // dash is dropped, since we only support language and region
90 let parts = selectedLocale.split("-"); 90 let parts = selectedLocale.split("-");
91 let language = parts[0]; 91 let language = parts[0];
92 let region = (parts[1] || "").toUpperCase(); 92 let region = (parts[1] || "").toUpperCase();
93 93
94 if (region) 94 if (region)
95 candidates.push(language + "-" + region); 95 candidates.push(language + "_" + region);
96 96
97 candidates.push(language); 97 candidates.push(language);
98 98
99 if (candidates.indexOf(defaultLocale) == -1) 99 if (candidates.indexOf(defaultLocale) == -1)
100 candidates.push(defaultLocale); 100 candidates.push(defaultLocale);
101 101
102 return candidates; 102 return candidates;
103 }; 103 };
104 104
105 let selectedLocale = window.navigator.language; 105 let selectedLocale = window.navigator.language;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 if (locales.length == 0) 188 if (locales.length == 0)
189 return ""; 189 return "";
190 190
191 let locale = locales.shift(); 191 let locale = locales.shift();
192 readCatalog(locale, "common.json"); 192 readCatalog(locale, "common.json");
193 readCatalog(locale, catalogFile); 193 readCatalog(locale, catalogFile);
194 } 194 }
195 } 195 }
196 }; 196 };
197 }()); 197 }());
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld