Use hard-coded list for default script direction
This commit is contained in:
parent
94539ceac5
commit
cc47a3aab5
2 changed files with 13 additions and 16 deletions
|
@ -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');
|
||||
};
|
||||
|
||||
|
|
|
@ -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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue