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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 if (/^\$\d+$/.test(content)) | 135 if (/^\$\d+$/.test(content)) |
136 placeholders[parseInt(content.substr(1), 10) - 1] = placeholder; | 136 placeholders[parseInt(content.substr(1), 10) - 1] = placeholder; |
137 else | 137 else |
138 text = replacePlaceholder(text, placeholder, content); | 138 text = replacePlaceholder(text, placeholder, content); |
139 } | 139 } |
140 | 140 |
141 return [text, placeholders]; | 141 return [text, placeholders]; |
142 }; | 142 }; |
143 | 143 |
144 var readCatalog = function(locale) | 144 var readCatalog = function(locale, catalogFile) |
145 { | 145 { |
146 var xhr = new XMLHttpRequest(); | 146 var xhr = new XMLHttpRequest(); |
147 xhr.open("GET", "locale/" + locale + "/" + catalogFile, false); | 147 xhr.open("GET", "locale/" + locale + "/" + catalogFile, false); |
148 xhr.overrideMimeType("text/plain"); | 148 xhr.overrideMimeType("text/plain"); |
149 | 149 |
150 try | 150 try |
151 { | 151 { |
152 xhr.send(); | 152 xhr.send(); |
153 } | 153 } |
154 catch (e) | 154 catch (e) |
(...skipping 28 matching lines...) Expand all Loading... |
183 | 183 |
184 for (var i = 0; i < placeholders.length; i++) | 184 for (var i = 0; i < placeholders.length; i++) |
185 text = replacePlaceholder(text, placeholders[i], substitutions[i]); | 185 text = replacePlaceholder(text, placeholders[i], substitutions[i]); |
186 | 186 |
187 return text; | 187 return text; |
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 var locale = locales.shift(); |
| 194 readCatalog(locale, "common.json"); |
| 195 readCatalog(locale, catalogFile); |
194 } | 196 } |
195 } | 197 } |
196 }; | 198 }; |
197 })(this); | 199 })(this); |
OLD | NEW |