Left: | ||
Right: |
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 |
(...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) | |
108 { | |
109 var bidi_dir = (ui_locale == "ar" || | |
110 ui_locale == "fa" || | |
111 ui_locale == "he" || | |
112 ui_locale == "ug" || | |
113 ui_locale == "ur") ? "rtl" : "ltr"; | |
114 | |
115 return { | |
116 __proto__: null, | |
117 | |
118 "@@ui_locale": [ui_locale, []], | |
119 "@@bidi_dir": [bidi_dir, []] | |
120 }; | |
Wladimir Palant
2014/12/09 18:59:09
Nit: Please consider using Object.create(null) ins
Sebastian Noack
2014/12/09 19:30:16
I haven't seen through your policy for unrelated c
Wladimir Palant
2014/12/09 19:55:37
The policy is very simple - fix the code when you
| |
121 }; | |
122 | |
107 var locales = getLocaleCandidates(); | 123 var locales = getLocaleCandidates(); |
108 var catalog = {__proto__: null, "@@ui_locale": [locales[0], []]}; | 124 var catalog = initCatalog(locales[0]); |
109 | 125 |
110 var replacePlaceholder = function(text, placeholder, content) | 126 var replacePlaceholder = function(text, placeholder, content) |
111 { | 127 { |
112 return text.split("$" + placeholder + "$").join(content || ""); | 128 return text.split("$" + placeholder + "$").join(content || ""); |
113 }; | 129 }; |
114 | 130 |
115 var parseMessage = function(rawMessage) | 131 var parseMessage = function(rawMessage) |
116 { | 132 { |
117 var text = rawMessage.message; | 133 var text = rawMessage.message; |
118 var placeholders = []; | 134 var placeholders = []; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
183 }; | 199 }; |
184 | 200 |
185 | 201 |
186 /* Utils */ | 202 /* Utils */ |
187 | 203 |
188 ext.getURL = function(path) | 204 ext.getURL = function(path) |
189 { | 205 { |
190 return safari.extension.baseURI + path; | 206 return safari.extension.baseURI + path; |
191 }; | 207 }; |
192 })(); | 208 })(); |
OLD | NEW |