| OLD | NEW | 
|---|
| 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   if (typeof chrome == "undefined") | 
|  | 23     window.chrome = {}; | 
|  | 24 | 
| 22   if (typeof ext == "undefined") | 25   if (typeof ext == "undefined") | 
| 23     window.ext = {}; | 26     window.ext = {}; | 
| 24 | 27 | 
| 25   function Page(source) | 28   function Page(source) | 
| 26   { | 29   { | 
| 27     this._source = source; | 30     this._source = source; | 
| 28   } | 31   } | 
| 29   Page.prototype = | 32   Page.prototype = | 
| 30   { | 33   { | 
| 31     sendMessage(message) | 34     sendMessage(message) | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 151       return; | 154       return; | 
| 152 | 155 | 
| 153     let rawCatalog = JSON.parse(xhr.responseText); | 156     let rawCatalog = JSON.parse(xhr.responseText); | 
| 154     for (let msgId in rawCatalog) | 157     for (let msgId in rawCatalog) | 
| 155     { | 158     { | 
| 156       if (!(msgId in catalog)) | 159       if (!(msgId in catalog)) | 
| 157         catalog[msgId] = parseMessage(rawCatalog[msgId]); | 160         catalog[msgId] = parseMessage(rawCatalog[msgId]); | 
| 158     } | 161     } | 
| 159   }; | 162   }; | 
| 160 | 163 | 
| 161   window.ext.i18n = { | 164   chrome.i18n = { | 
| 162     locale: locales[0], | 165     getUILanguage() | 
|  | 166     { | 
|  | 167       return locales[0].replace(/_/g, "-"); | 
|  | 168     }, | 
| 163     getMessage(msgId, substitutions) | 169     getMessage(msgId, substitutions) | 
| 164     { | 170     { | 
| 165       while (true) | 171       while (true) | 
| 166       { | 172       { | 
| 167         let message = catalog[msgId]; | 173         let message = catalog[msgId]; | 
| 168         if (message) | 174         if (message) | 
| 169         { | 175         { | 
| 170           let text = message[0]; | 176           let text = message[0]; | 
| 171           let placeholders = message[1]; | 177           let placeholders = message[1]; | 
| 172 | 178 | 
| 173           if (!(substitutions instanceof Array)) | 179           if (!(substitutions instanceof Array)) | 
| 174             substitutions = [substitutions]; | 180             substitutions = [substitutions]; | 
| 175 | 181 | 
| 176           for (let i = 0; i < placeholders.length; i++) | 182           for (let i = 0; i < placeholders.length; i++) | 
| 177             text = replacePlaceholder(text, placeholders[i], substitutions[i]); | 183             text = replacePlaceholder(text, placeholders[i], substitutions[i]); | 
| 178 | 184 | 
| 179           return text; | 185           return text; | 
| 180         } | 186         } | 
| 181 | 187 | 
| 182         if (locales.length == 0) | 188         if (locales.length == 0) | 
| 183           return ""; | 189           return ""; | 
| 184 | 190 | 
| 185         let locale = locales.shift(); | 191         let locale = locales.shift(); | 
| 186         readCatalog(locale, "common.json"); | 192         readCatalog(locale, "common.json"); | 
| 187         readCatalog(locale, catalogFile); | 193         readCatalog(locale, catalogFile); | 
| 188       } | 194       } | 
| 189     } | 195     } | 
| 190   }; | 196   }; | 
| 191 }()); | 197 }()); | 
| OLD | NEW | 
|---|