Index: lib/utils.js |
=================================================================== |
--- a/lib/utils.js |
+++ b/lib/utils.js |
@@ -44,10 +44,29 @@ |
}, |
get appLocale() |
{ |
- var locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); |
+ var locale = ext.i18n.getMessage("@@ui_locale"); |
+ if (locale === "") { |
Sebastian Noack
2016/03/14 09:03:06
Nit: We always use == (instead ===) where possible
|
+ locale = ext.i18n.getUILanguage(); |
+ } |
+ locale = locale.replace(/_/g, "-"); |
Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); |
return this.appLocale; |
}, |
+ get readingDirection() |
+ { |
+ var direction; |
+ if ("chromeRegistry" in this) { |
+ direction = this.chromeRegistry.isLocaleRTL("adblockplus") ? "rtl" : "ltr"; |
Sebastian Noack
2016/03/14 09:03:07
This code path is specific to Adblock Plus for Fir
|
+ } |
+ else { |
+ var direction = ext.i18n.getMessage("@bidi_dir"); |
+ if (direction === "") { |
+ direction = /^(ar|fa|he|ug|ur)(_|$)/.test(appLocale) ? "rtl" : "ltr"; |
Sebastian Noack
2016/03/14 09:03:07
This logic is redundant with code in safari/ext/co
|
+ } |
+ } |
+ Object.defineProperty(this, "readingDirection", {value: direction, enumerable: true}); |
+ return this.readingDirection; |
+ }, |
generateChecksum: function(lines) |
{ |
// We cannot calculate MD5 checksums yet :-( |