Index: lib/utils.js |
diff --git a/lib/utils.js b/lib/utils.js |
index 33e2fca6de0e6311cdff38eb84e402679c97db34..5b8746aa389d014cf3028ef7696e64087e39f72d 100644 |
--- a/lib/utils.js |
+++ b/lib/utils.js |
@@ -44,10 +44,37 @@ var Utils = exports.Utils = { |
}, |
get appLocale() |
{ |
- var locale = ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); |
+ var locale; |
+ try |
+ { |
+ locale = ext.i18n.getMessage("@@ui_locale"); |
+ } |
+ catch (exception) |
+ { |
+ // Edge does not yet (?) support @@ui_locale, throwing an exception here. |
+ } |
+ if (!locale) |
+ locale = ext.i18n.getUILanguage(); |
Sebastian Noack
2017/08/23 12:26:44
It seems we can use chrome.i18n.getUILanguage() re
|
+ locale = locale.replace(/_/g, "-"); |
Object.defineProperty(this, "appLocale", {value: locale, enumerable: true}); |
return this.appLocale; |
}, |
+ get readingDirection() |
+ { |
+ var direction; |
+ try |
+ { |
+ direction = ext.i18n.getMessage("@@bidi_dir"); |
+ } |
+ catch (exception) |
+ { |
+ // Edge does not yet (?) support @@bidi_dir, throwing an exception here. |
+ } |
+ if (!direction) |
+ direction = /^(ar|fa|he|ug|ur)(_|$)/.test(this.appLocale) ? "rtl" : "ltr"; |
+ Object.defineProperty(this, "readingDirection", {value: direction, enumerable: true}); |
+ return this.readingDirection; |
+ }, |
generateChecksum: function(lines) |
{ |
// We cannot calculate MD5 checksums yet :-( |