| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 ext.onMessage = new ext._EventTarget(); | 75 ext.onMessage = new ext._EventTarget(); |
| 76 | 76 |
| 77 | 77 |
| 78 /* I18n */ | 78 /* I18n */ |
| 79 | 79 |
| 80 var getLocaleCandidates = function() | 80 var getLocaleCandidates = function() |
| 81 { | 81 { |
| 82 var candidates = []; | 82 var candidates = []; |
| 83 var defaultLocale = "en_US"; | 83 var defaultLocale = "en_US"; |
| 84 | 84 |
| 85 // e.g. "ja-jp-mac" -> "ja", "jp", note that the part after the second | 85 // e.g. "ja-jp-mac" -> "ja_JP", note that the part after the second |
| 86 // dash is dropped, since we only support language and region | 86 // dash is dropped, since we only support language and region |
| 87 var [language, region] = navigator.language.split("-"); | 87 var [language, region] = navigator.language.split("-"); |
| 88 region = region.toUpperCase(); |
| 89 |
| 90 // e.g. "es-AR" -> "es_419", note that we combine all dialects of |
| 91 // Spanish outside of Spain, the same way Google Chrome does, |
| 92 // since we use the same translations as for the Chrome extension |
| 93 if (language == "es" && region && region != "ES") |
| 94 region = "419"; |
| 88 | 95 |
| 89 if (region) | 96 if (region) |
| 90 candidates.push(language + "_" + region.toUpperCase()); | 97 candidates.push(language + "_" + region); |
| 91 | 98 |
| 92 candidates.push(language); | 99 candidates.push(language); |
| 93 | 100 |
| 94 if (candidates.indexOf(defaultLocale) == -1) | 101 if (candidates.indexOf(defaultLocale) == -1) |
| 95 candidates.push(defaultLocale); | 102 candidates.push(defaultLocale); |
| 96 | 103 |
| 97 return candidates; | 104 return candidates; |
| 98 }; | 105 }; |
| 99 | 106 |
| 100 var locales = getLocaleCandidates(); | 107 var locales = getLocaleCandidates(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 }; | 183 }; |
| 177 | 184 |
| 178 | 185 |
| 179 /* Utils */ | 186 /* Utils */ |
| 180 | 187 |
| 181 ext.getURL = function(path) | 188 ext.getURL = function(path) |
| 182 { | 189 { |
| 183 return safari.extension.baseURI + path; | 190 return safari.extension.baseURI + path; |
| 184 }; | 191 }; |
| 185 })(); | 192 })(); |
| OLD | NEW |