OLD | NEW |
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 Loading... |
78 | 78 |
79 var getLocaleCandidates = function(selectedLocale) | 79 var getLocaleCandidates = function(selectedLocale) |
80 { | 80 { |
81 var candidates = []; | 81 var candidates = []; |
82 var defaultLocale = "en-US"; | 82 var defaultLocale = "en-US"; |
83 | 83 |
84 // e.g. "ja-jp-mac" -> "ja-JP", note that the part after the second | 84 // e.g. "ja-jp-mac" -> "ja-JP", note that the part after the second |
85 // dash is dropped, since we only support language and region | 85 // dash is dropped, since we only support language and region |
86 var parts = selectedLocale.split("-"); | 86 var parts = selectedLocale.split("-"); |
87 var language = parts[0]; | 87 var language = parts[0]; |
88 var region = (parts[1] || "").toUpperCase(); | 88 var region = (parts[1] || "").toUpperCase(); |
89 | 89 |
90 if (region) | 90 if (region) |
91 candidates.push(language + "-" + region); | 91 candidates.push(language + "-" + region); |
92 | 92 |
93 candidates.push(language); | 93 candidates.push(language); |
94 | 94 |
95 if (candidates.indexOf(defaultLocale) == -1) | 95 if (candidates.indexOf(defaultLocale) == -1) |
96 candidates.push(defaultLocale); | 96 candidates.push(defaultLocale); |
97 | 97 |
98 return candidates; | 98 return candidates; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 if (locales.length == 0) | 190 if (locales.length == 0) |
191 return ""; | 191 return ""; |
192 | 192 |
193 readCatalog(locales.shift()); | 193 readCatalog(locales.shift()); |
194 } | 194 } |
195 } | 195 } |
196 }; | 196 }; |
197 })(this); | 197 })(this); |
OLD | NEW |