Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: safari/ext/common.js

Issue 29338190: Issue 3697 - Fall back to i18n.getUILanguage if @ui_locale isn't supported (Closed)
Patch Set: Address comments. Created April 11, 2016, 4:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« lib/utils.js ('K') | « lib/utils.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 candidates.push(language); 119 candidates.push(language);
120 120
121 if (candidates.indexOf(defaultLocale) == -1) 121 if (candidates.indexOf(defaultLocale) == -1)
122 candidates.push(defaultLocale); 122 candidates.push(defaultLocale);
123 123
124 return candidates; 124 return candidates;
125 }; 125 };
126 126
127 var initCatalog = function(uiLocale) 127 var initCatalog = function(uiLocale)
128 { 128 {
129 var bidiDir = /^(ar|fa|he|ug|ur)(_|$)/.test(uiLocale) ? "rtl" : "ltr";
130 var catalog = Object.create(null); 129 var catalog = Object.create(null);
131
132 catalog["@@ui_locale"] = [uiLocale, []]; 130 catalog["@@ui_locale"] = [uiLocale, []];
133 catalog["@@bidi_dir" ] = [bidiDir, []];
134 131
135 return catalog; 132 return catalog;
136 }; 133 };
137 134
138 var locales = getLocaleCandidates(); 135 var locales = getLocaleCandidates();
139 var catalog = initCatalog(locales[0]); 136 var catalog = initCatalog(locales[0]);
140 137
141 var replacePlaceholder = function(text, placeholder, content) 138 var replacePlaceholder = function(text, placeholder, content)
142 { 139 {
143 return text.split("$" + placeholder + "$").join(content || ""); 140 return text.split("$" + placeholder + "$").join(content || "");
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 }; 211 };
215 212
216 213
217 /* Utils */ 214 /* Utils */
218 215
219 ext.getURL = function(path) 216 ext.getURL = function(path)
220 { 217 {
221 return safari.extension.baseURI + path; 218 return safari.extension.baseURI + path;
222 }; 219 };
223 })(); 220 })();
OLDNEW
« lib/utils.js ('K') | « lib/utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld