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-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 xhr.open("GET", safari.extension.baseURI + "_locales/" + locale + "/messag
es.json", false); | 144 xhr.open("GET", safari.extension.baseURI + "_locales/" + locale + "/messag
es.json", false); |
145 | 145 |
146 try { | 146 try { |
147 xhr.send(); | 147 xhr.send(); |
148 } | 148 } |
149 catch (e) | 149 catch (e) |
150 { | 150 { |
151 return null; | 151 return null; |
152 } | 152 } |
153 | 153 |
| 154 if (xhr.status != 200 && xhr.status != 0) |
| 155 return null; |
| 156 |
154 return JSON.parse(xhr.responseText); | 157 return JSON.parse(xhr.responseText); |
155 }, | 158 }, |
156 getMessage: function(msgId, substitutions) | 159 getMessage: function(msgId, substitutions) |
157 { | 160 { |
158 if (msgId == "@@ui_locale") | 161 if (msgId == "@@ui_locale") |
159 return this._uiLocale; | 162 return this._uiLocale; |
160 | 163 |
161 for (var i = 0; i < this._localeCandidates.length; i++) | 164 for (var i = 0; i < this._localeCandidates.length; i++) |
162 { | 165 { |
163 var catalog = this._getCatalog(this._localeCandidates[i]); | 166 var catalog = this._getCatalog(this._localeCandidates[i]); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 /* API */ | 212 /* API */ |
210 | 213 |
211 ext = { | 214 ext = { |
212 getURL: function(path) | 215 getURL: function(path) |
213 { | 216 { |
214 return safari.extension.baseURI + path; | 217 return safari.extension.baseURI + path; |
215 }, | 218 }, |
216 i18n: new I18n() | 219 i18n: new I18n() |
217 }; | 220 }; |
218 })(); | 221 })(); |
OLD | NEW |