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

Delta Between Two Patch Sets: lib/utils.js

Issue 29338190: Issue 3697 - Fall back to i18n.getUILanguage if @ui_locale isn't supported (Closed)
Left Patch Set: Remove redundant underscore replacement Created Aug. 30, 2017, 9:10 a.m.
Right Patch Set: Address the nits Created Aug. 30, 2017, 10:59 p.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 | « lib/notificationHelper.js ('k') | 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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 } 42 }
43 }, 43 },
44 get appLocale() 44 get appLocale()
45 { 45 {
46 let locale = ext.i18n.getUILanguage(); 46 let locale = ext.i18n.getUILanguage();
47 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); 47 Object.defineProperty(this, "appLocale", {value: locale, enumerable: true});
48 return this.appLocale; 48 return this.appLocale;
49 }, 49 },
50 get readingDirection() 50 get readingDirection()
51 { 51 {
52 let direction = ext.i18n.getMessage("@@bidi_dir"); 52 let direction = ext.i18n.getMessage("@@bidi_dir");
kzar 2017/08/30 11:54:09 Shouldn't we also make use of this.readingDirectio
kzar 2017/08/30 13:55:02 Argh, disregard that! I see how this works now, we
53 // This fallback is only necessary for Microsoft Edge
53 if (!direction) 54 if (!direction)
kzar 2017/08/30 11:54:09 Nit: Please use braces since it spans multiple lin
Sebastian Noack 2017/08/30 16:28:24 I'd rather just move the comment above.
Oleksandr 2017/08/30 23:00:36 Done.
54 // This fallback is only necessary for Microsoft Edge
55 direction = /^(?:ar|fa|he|ug|ur)\b/.test(this.appLocale) ? "rtl" : "ltr"; 55 direction = /^(?:ar|fa|he|ug|ur)\b/.test(this.appLocale) ? "rtl" : "ltr";
kzar 2017/08/30 11:54:09 (I assume Sebastian checked this regexp, I have no
Sebastian Noack 2017/08/30 16:28:24 For reference, this is the regular expression we u
Oleksandr 2017/08/30 23:00:36 Based on the list here: https://msdn.microsoft.com
56 Object.defineProperty( 56 Object.defineProperty(
57 this, 57 this,
58 "readingDirection", 58 "readingDirection",
59 {value: direction, enumerable: true}); 59 {value: direction, enumerable: true}
kzar 2017/08/30 11:54:09 Nit: Please put the closing parenthesis on the fol
60 );
60 return this.readingDirection; 61 return this.readingDirection;
61 }, 62 },
62 generateChecksum(lines) 63 generateChecksum(lines)
63 { 64 {
64 // We cannot calculate MD5 checksums yet :-( 65 // We cannot calculate MD5 checksums yet :-(
65 return null; 66 return null;
66 }, 67 },
67 checkLocalePrefixMatch(prefixes) 68 checkLocalePrefixMatch(prefixes)
68 { 69 {
69 if (!prefixes) 70 if (!prefixes)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 { 123 {
123 let docLink = require("prefs").Prefs.documentation_link; 124 let docLink = require("prefs").Prefs.documentation_link;
124 return docLink.replace(/%LINK%/g, linkID) 125 return docLink.replace(/%LINK%/g, linkID)
125 .replace(/%LANG%/g, Utils.appLocale); 126 .replace(/%LANG%/g, Utils.appLocale);
126 }, 127 },
127 128
128 yield() 129 yield()
129 { 130 {
130 } 131 }
131 }; 132 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld