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 |
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 var i18n; | 18 var i18n; |
19 if (typeof chrome != "undefined") | 19 |
20 { | 20 if (typeof ext != "undefined") |
| 21 i18n = ext.i18n; |
| 22 else if (typeof chrome != "undefined") |
| 23 // TODO: This check only exist for backwards compatibility, while the Safari |
| 24 // port isn't merged into the adblockpluschrome repo. So this branch should |
| 25 // be removed when the Safari port was merged. |
21 i18n = chrome.i18n; | 26 i18n = chrome.i18n; |
22 } | |
23 else | 27 else |
24 { | 28 { |
25 // Using Firefox' approach on i18n instead | 29 // Using Firefox' approach on i18n instead |
26 | 30 |
27 // Randomize URI to work around bug 719376 | 31 // Randomize URI to work around bug 719376 |
28 var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, ''); | 32 var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, ''); |
29 var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/
" + pageName + | 33 var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/
" + pageName + |
30 ".properties?" + Math.random()); | 34 ".properties?" + Math.random()); |
31 | 35 |
32 function getI18nMessage(key) | 36 function getI18nMessage(key) |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 141 |
138 var now = new Date(); | 142 var now = new Date(); |
139 if (d.toDateString() == now.toDateString()) | 143 if (d.toDateString() == now.toDateString()) |
140 return [timeString]; | 144 return [timeString]; |
141 else | 145 else |
142 return [timeString, d.toLocaleDateString()]; | 146 return [timeString, d.toLocaleDateString()]; |
143 } | 147 } |
144 | 148 |
145 // Fill in the strings as soon as possible | 149 // Fill in the strings as soon as possible |
146 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); | 150 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); |
OLD | NEW |