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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 candidates.push(language + "_" + region); | 97 candidates.push(language + "_" + region); |
98 | 98 |
99 candidates.push(language); | 99 candidates.push(language); |
100 | 100 |
101 if (candidates.indexOf(defaultLocale) == -1) | 101 if (candidates.indexOf(defaultLocale) == -1) |
102 candidates.push(defaultLocale); | 102 candidates.push(defaultLocale); |
103 | 103 |
104 return candidates; | 104 return candidates; |
105 }; | 105 }; |
106 | 106 |
107 var initCatalog = function(ui_locale) | 107 var initCatalog = function(uiLocale) |
108 { | 108 { |
109 var bidi_dir = (ui_locale == "ar" || | 109 var bidiDir = /^(ar|fa|he|ug|ur)(_|$)/.test(uiLocale) ? "rtl" : "ltr"; |
Wladimir Palant
2014/12/11 16:52:15
I only realized now that we are looking at UI loca
Sebastian Noack
2014/12/11 17:03:05
To be honest I didn't consider that case and agree
| |
110 ui_locale == "fa" || | |
111 ui_locale == "he" || | |
112 ui_locale == "ug" || | |
113 ui_locale == "ur") ? "rtl" : "ltr"; | |
114 | |
115 var catalog = Object.create(null); | 110 var catalog = Object.create(null); |
116 catalog["@@ui_locale"] = [ui_locale, []]; | 111 |
117 catalog["@@bidi_dir" ] = [bidi_dir, []]; | 112 catalog["@@ui_locale"] = [uiLocale, []]; |
113 catalog["@@bidi_dir" ] = [bidiDir, []]; | |
114 | |
118 return catalog; | 115 return catalog; |
119 }; | 116 }; |
120 | 117 |
121 var locales = getLocaleCandidates(); | 118 var locales = getLocaleCandidates(); |
122 var catalog = initCatalog(locales[0]); | 119 var catalog = initCatalog(locales[0]); |
123 | 120 |
124 var replacePlaceholder = function(text, placeholder, content) | 121 var replacePlaceholder = function(text, placeholder, content) |
125 { | 122 { |
126 return text.split("$" + placeholder + "$").join(content || ""); | 123 return text.split("$" + placeholder + "$").join(content || ""); |
127 }; | 124 }; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 }; | 194 }; |
198 | 195 |
199 | 196 |
200 /* Utils */ | 197 /* Utils */ |
201 | 198 |
202 ext.getURL = function(path) | 199 ext.getURL = function(path) |
203 { | 200 { |
204 return safari.extension.baseURI + path; | 201 return safari.extension.baseURI + path; |
205 }; | 202 }; |
206 })(); | 203 })(); |
LEFT | RIGHT |