Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: chrome/content/ui/i18n.js

Issue 11533106: Prepared adblockplus for Safari (Closed)
Patch Set: Fixed broken path to CSS for firefox Created Sept. 6, 2013, 5:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 = (window.ext && ext.i18n) || (window.chrome && chrome.i18n);
Wladimir Palant 2013/09/10 06:53:46 This will produce a warning in JavaScript - you ar
Wladimir Palant 2013/09/10 07:10:40 A warning in Firefox is what I meant of course.
Sebastian Noack 2013/09/10 10:56:29 I couldn't reproduce that. Accessing an undefined
Wladimir Palant 2013/09/10 11:10:14 You need to enable javascript.option.strict prefer
Sebastian Noack 2013/09/10 14:20:57 Sure, in strict mode that wouldn't work anymore. I
Wladimir Palant 2013/09/10 14:34:21 That's just a development setting, not strict mode
19 if (typeof chrome != "undefined") 19 if (!i18n)
20 {
21 i18n = chrome.i18n;
22 }
23 else
24 { 20 {
25 // Using Firefox' approach on i18n instead 21 // Using Firefox' approach on i18n instead
26 22
27 // Randomize URI to work around bug 719376 23 // Randomize URI to work around bug 719376
28 var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, ''); 24 var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, '');
29 var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/ " + pageName + 25 var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/ " + pageName +
30 ".properties?" + Math.random()); 26 ".properties?" + Math.random());
31 27
32 function getI18nMessage(key) 28 function getI18nMessage(key)
33 { 29 {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 127
132 var now = new Date(); 128 var now = new Date();
133 if (d.toDateString() == now.toDateString()) 129 if (d.toDateString() == now.toDateString())
134 return [timeString]; 130 return [timeString];
135 else 131 else
136 return [timeString, d.toLocaleDateString()]; 132 return [timeString, d.toLocaleDateString()];
137 } 133 }
138 134
139 // Fill in the strings as soon as possible 135 // Fill in the strings as soon as possible
140 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); 136 window.addEventListener("DOMContentLoaded", loadI18nStrings, true);
OLDNEW

Powered by Google App Engine
This is Rietveld