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