diff --git a/chrome/content/zotero/xpcom/intl.js b/chrome/content/zotero/xpcom/intl.js index d13ef8218c..5e14f3837d 100644 --- a/chrome/content/zotero/xpcom/intl.js +++ b/chrome/content/zotero/xpcom/intl.js @@ -47,21 +47,7 @@ Zotero.Intl = new function () { .GetStringFromName('brandShortName'); // Set the locale direction to Zotero.dir - Zotero.dir = 'ltr'; - - // TODO: is there a better way to get the entity from JS? - if (!(Zotero.isNode || Zotero.isElectron)) { - let xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"] - .createInstance(); - xmlhttp.open('GET', 'chrome://global/locale/global.dtd', false); - xmlhttp.overrideMimeType('text/plain'); - xmlhttp.send(null); - let matches = xmlhttp.responseText.match(/(ltr|rtl)/); - if (matches && matches[0] == 'rtl') { - Zotero.dir = 'rtl'; - } - } - + Zotero.dir = Zotero.Locale.defaultScriptDirection(Zotero.locale); Zotero.rtl = (Zotero.dir === 'rtl'); }; diff --git a/chrome/content/zotero/xpcom/locale.js b/chrome/content/zotero/xpcom/locale.js index 9b3b1315c0..7b1fb4c5db 100644 --- a/chrome/content/zotero/xpcom/locale.js +++ b/chrome/content/zotero/xpcom/locale.js @@ -40,5 +40,16 @@ Zotero.Locale = { 'vi-VN': 'Tiếng Việt', 'zh-CN': '中文 (简体)', 'zh-TW': '正體中文 (繁體)' - }) + }), + + defaultScriptDirection(locale) { + switch (locale.split('-')[0]) { + case 'ar': + case 'fa': + case 'he': + return 'rtl'; + default: + return 'ltr'; + } + } }