Left: | ||
Right: |
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-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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 { | 45 { |
46 var bidiDir = /^(ar|fa|he|ug|ur)(-|$)/.test(uiLocale) ? "rtl" : "ltr"; | 46 var bidiDir = /^(ar|fa|he|ug|ur)(-|$)/.test(uiLocale) ? "rtl" : "ltr"; |
47 var catalog = Object.create(null); | 47 var catalog = Object.create(null); |
48 | 48 |
49 catalog["@@ui_locale"] = [uiLocale.replace(/-/g, "_"), []]; | 49 catalog["@@ui_locale"] = [uiLocale.replace(/-/g, "_"), []]; |
50 catalog["@@bidi_dir" ] = [bidiDir, []]; | 50 catalog["@@bidi_dir" ] = [bidiDir, []]; |
51 | 51 |
52 return catalog; | 52 return catalog; |
53 }; | 53 }; |
54 | 54 |
55 var selectedLocale = navigator.language; | 55 var selectedLocale = window.navigator.language; |
Thomas Greiner
2014/12/17 13:43:40
Change to `global.navigator.language` for consiste
Wladimir Palant
2014/12/17 14:19:45
navigator isn't a property of generic global objec
Thomas Greiner
2014/12/17 15:13:52
Do you have a relevant scenario in mind in which w
Wladimir Palant
2014/12/17 15:25:54
Not here of course - but the implementation in Fir
| |
56 var match = /[?&]locale=([\w\-]+)/.exec(window.location.search); | 56 var match = /[?&]locale=([\w\-]+)/.exec(window.location.search); |
Thomas Greiner
2014/12/17 13:43:40
Change to `global.location.search`
| |
57 if (match) | 57 if (match) |
58 selectedLocale = match[1]; | 58 selectedLocale = match[1]; |
59 | 59 |
60 var locales = getLocaleCandidates(selectedLocale); | 60 var locales = getLocaleCandidates(selectedLocale); |
61 var catalog = initCatalog(locales[0]); | 61 var catalog = initCatalog(locales[0]); |
62 var catalogFile = window.location.pathname.replace(/.*\//, "").replace(/\..*/, "") + ".json"; | 62 var catalogFile = window.location.pathname.replace(/.*\//, "").replace(/\..*/, "") + ".json"; |
Thomas Greiner
2014/12/17 13:43:40
Change to `global.location.pathname`
| |
63 | 63 |
64 var replacePlaceholder = function(text, placeholder, content) | 64 var replacePlaceholder = function(text, placeholder, content) |
65 { | 65 { |
66 return text.split("$" + placeholder + "$").join(content || ""); | 66 return text.split("$" + placeholder + "$").join(content || ""); |
67 }; | 67 }; |
68 | 68 |
69 var parseMessage = function(rawMessage) | 69 var parseMessage = function(rawMessage) |
70 { | 70 { |
71 var text = rawMessage.message; | 71 var text = rawMessage.message; |
72 var placeholders = []; | 72 var placeholders = []; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 } | 134 } |
135 | 135 |
136 if (locales.length == 0) | 136 if (locales.length == 0) |
137 return ""; | 137 return ""; |
138 | 138 |
139 readCatalog(locales.shift()); | 139 readCatalog(locales.shift()); |
140 } | 140 } |
141 } | 141 } |
142 }; | 142 }; |
143 })(this); | 143 })(this); |
LEFT | RIGHT |