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

Unified Diff: lib/utils.js

Issue 29338190: Issue 3697 - Fall back to i18n.getUILanguage if @ui_locale isn't supported (Closed)
Patch Set: Update the adblockplusui dependency. Add a comment. Change regexp. Created Aug. 29, 2017, 1:34 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« dependencies ('K') | « lib/notificationHelper.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/utils.js
===================================================================
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -43,10 +43,22 @@
},
get appLocale()
{
- let locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-");
+ let locale = ext.i18n.getUILanguage().replace(/_/g, "-");
Sebastian Noack 2017/08/30 00:22:12 I just noticed, getUILanguage() as opposed to getM
Object.defineProperty(this, "appLocale", {value: locale, enumerable: true});
return this.appLocale;
},
+ get readingDirection()
+ {
+ let direction = ext.i18n.getMessage("@@bidi_dir");
+ if (!direction)
+ // This fallback is only necessary for Microsoft Edge
+ direction = /^(?:ar|fa|he|ug|ur)\b/.test(this.appLocale) ? "rtl" : "ltr";
+ Object.defineProperty(
+ this,
+ "readingDirection",
+ {value: direction, enumerable: true});
+ return this.readingDirection;
+ },
generateChecksum(lines)
{
// We cannot calculate MD5 checksums yet :-(
« dependencies ('K') | « lib/notificationHelper.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld