OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 25 matching lines...) Expand all Loading... |
36 }; | 36 }; |
37 document.addEventListener("DOMContentLoaded", onDOMContentLoaded); | 37 document.addEventListener("DOMContentLoaded", onDOMContentLoaded); |
38 } | 38 } |
39 else | 39 else |
40 { | 40 { |
41 setTimeout(callback, 0); | 41 setTimeout(callback, 0); |
42 } | 42 } |
43 }, | 43 }, |
44 get appLocale() | 44 get appLocale() |
45 { | 45 { |
46 let locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); | 46 let locale = ext.i18n.getUILanguage(); |
47 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); | 47 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); |
48 return this.appLocale; | 48 return this.appLocale; |
49 }, | 49 }, |
| 50 get readingDirection() |
| 51 { |
| 52 let direction = ext.i18n.getMessage("@@bidi_dir"); |
| 53 // This fallback is only necessary for Microsoft Edge |
| 54 if (!direction) |
| 55 direction = /^(?:ar|fa|he|ug|ur)\b/.test(this.appLocale) ? "rtl" : "ltr"; |
| 56 Object.defineProperty( |
| 57 this, |
| 58 "readingDirection", |
| 59 {value: direction, enumerable: true} |
| 60 ); |
| 61 return this.readingDirection; |
| 62 }, |
50 generateChecksum(lines) | 63 generateChecksum(lines) |
51 { | 64 { |
52 // We cannot calculate MD5 checksums yet :-( | 65 // We cannot calculate MD5 checksums yet :-( |
53 return null; | 66 return null; |
54 }, | 67 }, |
55 checkLocalePrefixMatch(prefixes) | 68 checkLocalePrefixMatch(prefixes) |
56 { | 69 { |
57 if (!prefixes) | 70 if (!prefixes) |
58 return null; | 71 return null; |
59 | 72 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 { | 123 { |
111 let docLink = require("prefs").Prefs.documentation_link; | 124 let docLink = require("prefs").Prefs.documentation_link; |
112 return docLink.replace(/%LINK%/g, linkID) | 125 return docLink.replace(/%LINK%/g, linkID) |
113 .replace(/%LANG%/g, Utils.appLocale); | 126 .replace(/%LANG%/g, Utils.appLocale); |
114 }, | 127 }, |
115 | 128 |
116 yield() | 129 yield() |
117 { | 130 { |
118 } | 131 } |
119 }; | 132 }; |
OLD | NEW |