| 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-2014 Eyeo GmbH | 3  * Copyright (C) 2006-2014 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 { | 
| 21   i18n = ext.i18n; | 22   i18n = ext.i18n; | 
| 22 else if (typeof chrome != "undefined") | 23 | 
| 23   // TODO: This check only exist for backwards compatibility, while the Safari | 24   document.documentElement.lang = ext.i18n.getMessage("@@ui_locale").replace(/_/
     g, "-"); | 
| 24   // port isn't merged into the adblockpluschrome repo. So this branch should | 25   document.documentElement.dir = ext.i18n.getMessage("@@bidi_dir"); | 
| 25   // be removed when the Safari port was merged. | 26 } | 
| 26   i18n = chrome.i18n; |  | 
| 27 else | 27 else | 
| 28 { | 28 { | 
| 29   // Using Firefox' approach on i18n instead | 29   // Using Firefox' approach on i18n instead | 
| 30 | 30 | 
| 31   // Randomize URI to work around bug 719376 | 31   // Randomize URI to work around bug 719376 | 
| 32   var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, ''); | 32   var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, ''); | 
| 33   var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/
     " + pageName + | 33   var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/
     " + pageName + | 
| 34     ".properties?" + Math.random()); | 34     ".properties?" + Math.random()); | 
| 35 | 35 | 
| 36   function getI18nMessage(key) | 36   function getI18nMessage(key) | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 77           return getText(message, args); | 77           return getText(message, args); | 
| 78         } | 78         } | 
| 79         catch(e) | 79         catch(e) | 
| 80         { | 80         { | 
| 81           Cu.reportError(e); | 81           Cu.reportError(e); | 
| 82           return "Missing translation: " + key; | 82           return "Missing translation: " + key; | 
| 83         } | 83         } | 
| 84       } | 84       } | 
| 85     }; | 85     }; | 
| 86   })(); | 86   })(); | 
|  | 87 | 
|  | 88   var Utils = require("utils").Utils; | 
|  | 89   document.documentElement.lang = Utils.appLocale; | 
|  | 90   document.documentElement.dir = Utils.chromeRegistry.isLocaleRTL("adblockplus")
      ? "rtl" : "ltr"; | 
| 87 } | 91 } | 
| 88 | 92 | 
| 89 // Inserts i18n strings into matching elements. Any inner HTML already in the el
     ement is | 93 // Inserts i18n strings into matching elements. Any inner HTML already in the el
     ement is | 
| 90 // parsed as JSON and used as parameters to substitute into placeholders in the 
     i18n | 94 // parsed as JSON and used as parameters to substitute into placeholders in the 
     i18n | 
| 91 // message. | 95 // message. | 
| 92 i18n.setElementText = function(element, stringName, arguments) | 96 i18n.setElementText = function(element, stringName, arguments) | 
| 93 { | 97 { | 
| 94   function processString(str, element) | 98   function processString(str, element) | 
| 95   { | 99   { | 
| 96     var match = /^(.*?)<(a|strong)>(.*?)<\/\2>(.*)$/.exec(str); | 100     var match = /^(.*?)<(a|strong)>(.*?)<\/\2>(.*)$/.exec(str); | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 141 | 145 | 
| 142   var now = new Date(); | 146   var now = new Date(); | 
| 143   if (d.toDateString() == now.toDateString()) | 147   if (d.toDateString() == now.toDateString()) | 
| 144     return [timeString]; | 148     return [timeString]; | 
| 145   else | 149   else | 
| 146     return [timeString, d.toLocaleDateString()]; | 150     return [timeString, d.toLocaleDateString()]; | 
| 147 } | 151 } | 
| 148 | 152 | 
| 149 // Fill in the strings as soon as possible | 153 // Fill in the strings as soon as possible | 
| 150 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); | 154 window.addEventListener("DOMContentLoaded", loadI18nStrings, true); | 
| OLD | NEW | 
|---|