Add intl.accept_languages from Mozilla language packs
This commit is contained in:
parent
d8b201487d
commit
e475b22f1d
46 changed files with 72 additions and 3 deletions
|
@ -224,12 +224,36 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
|||
// Browser
|
||||
Zotero.browser = "g";
|
||||
|
||||
// Get resolved locale
|
||||
//
|
||||
// Get settings from language pack (extracted by zotero-build/locale/merge_mozilla_files)
|
||||
//
|
||||
function getIntlProp(name, fallback = null) {
|
||||
try {
|
||||
return intlProps.GetStringFromName(name);
|
||||
}
|
||||
catch (e) {
|
||||
Zotero.logError(`Couldn't load ${name} from intl.properties`);
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
function setOrClearIntlPref(name, type) {
|
||||
var val = getIntlProp(name);
|
||||
if (val !== null) {
|
||||
if (type == 'boolean') {
|
||||
val = val == 'true';
|
||||
}
|
||||
Zotero.Prefs.set(name, val, 1);
|
||||
}
|
||||
else {
|
||||
Zotero.Prefs.clear(name, 1);
|
||||
}
|
||||
}
|
||||
var intlProps = Services.strings.createBundle("chrome://zotero/locale/mozilla/intl.properties");
|
||||
this.locale = intlProps.GetStringFromName("general.useragent.locale");
|
||||
let [get, numForms] = PluralForm.makeGetter(intlProps.GetStringFromName("pluralRule"));
|
||||
this.locale = getIntlProp('general.useragent.locale', 'en-US');
|
||||
let [get, numForms] = PluralForm.makeGetter(parseInt(getIntlProp('pluralRule', 1)));
|
||||
this.pluralFormGet = get;
|
||||
this.pluralFormNumForms = numForms;
|
||||
setOrClearIntlPref('intl.accept_languages', 'string');
|
||||
|
||||
// Also load the brand as appName
|
||||
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=af-ZA
|
||||
intl.accept_languages=af, en-ZA, en-GB, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=ar
|
||||
intl.accept_languages=ar, en-us, en
|
||||
pluralRule=12
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=bg-BG
|
||||
intl.accept_languages=bg, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=ca-AD
|
||||
intl.accept_languages=ca, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=cs-CZ
|
||||
pluralRule=8
|
||||
intl.accept_languages=cs, en-us, en
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=da-DK
|
||||
pluralRule=1
|
||||
intl.accept_languages=da, en-us, en
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=de
|
||||
intl.accept_languages=de, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=el-GR
|
||||
intl.accept_languages=el-GR, el, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=en-US
|
||||
intl.accept_languages=en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale =es-ES
|
||||
intl.accept_languages = es-ES, es, en-US, en
|
||||
pluralRule = 1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=et-EE
|
||||
pluralRule=1
|
||||
intl.accept_languages=et, et-ee, en-us, en
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=eu-ES
|
||||
intl.accept_languages=eu, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=fa
|
||||
intl.accept_languages=fa-ir, fa, en-us, en
|
||||
pluralRule=0
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=fi-FI
|
||||
intl.accept_languages=fi-fi, fi, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=fr-FR
|
||||
pluralRule=2
|
||||
intl.accept_languages=fr, fr-fr, en-us, en
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=en-US
|
||||
intl.accept_languages=en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=he-IL
|
||||
intl.accept_languages=he, he-IL, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=hr-HR
|
||||
intl.accept_languages=hr-hr, hr, en-us, en
|
||||
pluralRule=7
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=hu-HU
|
||||
intl.accept_languages=hu-hu, hu, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=id-ID
|
||||
intl.accept_languages=id, en-us, en
|
||||
pluralRule=0
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=is-IS
|
||||
intl.accept_languages=is, en-us, en
|
||||
pluralRule=15
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale =it-IT
|
||||
intl.accept_languages = it-IT, it, en-US, en
|
||||
pluralRule = 1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale =ja-JP
|
||||
intl.accept_languages = ja, en-us, en
|
||||
pluralRule = 0
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=km
|
||||
intl.accept_languages=km, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=ko-KR
|
||||
intl.accept_languages=ko-kr, ko, en-us, en
|
||||
pluralRule=0
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=lt-LT
|
||||
intl.accept_languages=lt, en-us, en, ru, pl
|
||||
pluralRule=6
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=en-US
|
||||
intl.accept_languages=en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=nb-NO
|
||||
intl.accept_languages=nb-no, nb, no-no, no, nn-no, nn, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=nl-NL
|
||||
intl.accept_languages=nl, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=nn-NO
|
||||
intl.accept_languages=nn-no, nn, no-no, no, nb-no, nb, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=pl-PL
|
||||
intl.accept_languages=pl, en-US, en
|
||||
pluralRule=9
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=pt-BR
|
||||
intl.accept_languages=pt-BR, pt, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=pt-PT
|
||||
intl.accept_languages=pt-pt, pt, en, en-us
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=ro-RO
|
||||
pluralRule=1
|
||||
intl.accept_languages=ro-ro, ro, en-us, en-gb, en
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale =ru-RU
|
||||
intl.accept_languages = ru-RU, ru, en-US, en
|
||||
pluralRule = 7
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=sk-SK
|
||||
intl.accept_languages=sk, cs, en-US, en
|
||||
pluralRule=8
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=sl-SI
|
||||
intl.accept_languages=sl, en-gb, en
|
||||
pluralRule=10
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=sr-RS
|
||||
intl.accept_languages=sr, sr-rs, sr-cs, en-us, en
|
||||
pluralRule=7
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=sv-SE
|
||||
intl.accept_languages=sv-SE, sv, en-US, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=th-TH
|
||||
intl.accept_languages=th-th, th, en-us, en-gb, en
|
||||
pluralRule=0
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=tr-TR
|
||||
intl.accept_languages=tr-TR, tr, en-US, en
|
||||
pluralRule=0
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=uk-UA
|
||||
intl.accept_languages=uk, ru, en-us, en
|
||||
pluralRule=7
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=vi-VN
|
||||
intl.accept_languages=vi-vn, vi, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=zh-CN
|
||||
intl.accept_languages=zh-cn, zh, en-us, en
|
||||
pluralRule=1
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
general.useragent.locale=zh-TW
|
||||
intl.accept_languages=zh-tw, zh, en-us, en
|
||||
pluralRule=0
|
||||
|
|
Loading…
Reference in a new issue