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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 candidates.push(language); | 123 candidates.push(language); |
124 | 124 |
125 if (candidates.indexOf(defaultLocale) == -1) | 125 if (candidates.indexOf(defaultLocale) == -1) |
126 candidates.push(defaultLocale); | 126 candidates.push(defaultLocale); |
127 | 127 |
128 return candidates; | 128 return candidates; |
129 }; | 129 }; |
130 | 130 |
131 var initCatalog = function(uiLocale) | 131 var initCatalog = function(uiLocale) |
132 { | 132 { |
133 var bidiDir = /^(ar|fa|he|ug|ur)(_|$)/.test(uiLocale) ? "rtl" : "ltr"; | |
134 var catalog = Object.create(null); | 133 var catalog = Object.create(null); |
135 | |
136 catalog["@@ui_locale"] = [uiLocale, []]; | 134 catalog["@@ui_locale"] = [uiLocale, []]; |
137 catalog["@@bidi_dir" ] = [bidiDir, []]; | |
138 | 135 |
139 return catalog; | 136 return catalog; |
140 }; | 137 }; |
141 | 138 |
142 var locales = getLocaleCandidates(); | 139 var locales = getLocaleCandidates(); |
143 var catalog = initCatalog(locales[0]); | 140 var catalog = initCatalog(locales[0]); |
144 | 141 |
145 var replacePlaceholder = function(text, placeholder, content) | 142 var replacePlaceholder = function(text, placeholder, content) |
146 { | 143 { |
147 return text.split("$" + placeholder + "$").join(content || ""); | 144 return text.split("$" + placeholder + "$").join(content || ""); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 }; | 215 }; |
219 | 216 |
220 | 217 |
221 /* Utils */ | 218 /* Utils */ |
222 | 219 |
223 ext.getURL = function(path) | 220 ext.getURL = function(path) |
224 { | 221 { |
225 return safari.extension.baseURI + path; | 222 return safari.extension.baseURI + path; |
226 }; | 223 }; |
227 })(); | 224 })(); |
OLD | NEW |