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

Delta Between Two Patch Sets: safari/ext/common.js

Issue 5404244093960192: Issue 1678 - Added bidi support for Safari (Closed)
Left Patch Set: Ignore region Created Dec. 10, 2014, 8:16 a.m.
Right Patch Set: Addressed comments Created Dec. 10, 2014, 10:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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)
Thomas Greiner 2014/12/10 10:29:42 Style nit: I do see why you used underscores here
Sebastian Noack 2014/12/10 10:37:29 That wasn't an aware decision. It happened rather
108 { 108 {
109 var bidi_dir = /^(ar|fa|he|ug|ur)_|$/.test(ui_locale) ? "rtl" : "ltr"; 109 var bidiDir = /^(ar|fa|he|ug|ur)(_|$)/.test(uiLocale) ? "rtl" : "ltr";
Thomas Greiner 2014/12/10 10:29:42 This regular expression will match any string due
Sebastian Noack 2014/12/10 10:37:29 Ouch, I forgot to set parentheses.
Thomas Greiner 2014/12/10 11:12:12 The corrected version still matches "ar_". By addi
Sebastian Noack 2014/12/10 11:32:06 Why should we care? We want to match "ar" and "ar_
Thomas Greiner 2014/12/10 12:06:02 I can agree with that line of argument.
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 var catalog = Object.create(null); 110 var catalog = Object.create(null);
111 111
112 catalog["@@ui_locale"] = [ui_locale, []]; 112 catalog["@@ui_locale"] = [uiLocale, []];
113 catalog["@@bidi_dir" ] = [bidi_dir, []]; 113 catalog["@@bidi_dir" ] = [bidiDir, []];
114 114
115 return catalog; 115 return catalog;
116 }; 116 };
117 117
118 var locales = getLocaleCandidates(); 118 var locales = getLocaleCandidates();
119 var catalog = initCatalog(locales[0]); 119 var catalog = initCatalog(locales[0]);
120 120
121 var replacePlaceholder = function(text, placeholder, content) 121 var replacePlaceholder = function(text, placeholder, content)
122 { 122 {
123 return text.split("$" + placeholder + "$").join(content || ""); 123 return text.split("$" + placeholder + "$").join(content || "");
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 }; 194 };
195 195
196 196
197 /* Utils */ 197 /* Utils */
198 198
199 ext.getURL = function(path) 199 ext.getURL = function(path)
200 { 200 {
201 return safari.extension.baseURI + path; 201 return safari.extension.baseURI + path;
202 }; 202 };
203 })(); 203 })();
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld