Fix PluralForm support
The library was using the plural rule defined in the built-in intl.properties, but that was always en-US in the standalone app.
This commit is contained in:
parent
c2234176aa
commit
521f291b84
46 changed files with 60 additions and 15 deletions
|
@ -225,18 +225,18 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
||||||
Zotero.browser = "g";
|
Zotero.browser = "g";
|
||||||
|
|
||||||
// Get resolved locale
|
// Get resolved locale
|
||||||
this.locale = Services.strings.createBundle("chrome://zotero/locale/mozilla/intl.properties")
|
var intlProps = Services.strings.createBundle("chrome://zotero/locale/mozilla/intl.properties");
|
||||||
.GetStringFromName("general.useragent.locale");
|
this.locale = intlProps.GetStringFromName("general.useragent.locale");
|
||||||
|
let [get, numForms] = PluralForm.makeGetter(intlProps.GetStringFromName("pluralRule"));
|
||||||
_localizedStringBundle = Services.strings.createBundle("chrome://zotero/locale/zotero.properties");
|
this.pluralFormGet = get;
|
||||||
// Fix logged error in PluralForm.jsm when numForms() is called before get(), as it is in
|
this.pluralFormNumForms = numForms;
|
||||||
// getString() when a number is based
|
|
||||||
PluralForm.get(1, '1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16')
|
|
||||||
|
|
||||||
// Also load the brand as appName
|
// Also load the brand as appName
|
||||||
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties");
|
||||||
this.appName = brandBundle.GetStringFromName("brandShortName");
|
this.appName = brandBundle.GetStringFromName("brandShortName");
|
||||||
|
|
||||||
|
_localizedStringBundle = Services.strings.createBundle("chrome://zotero/locale/zotero.properties");
|
||||||
|
|
||||||
// Set the locale direction to Zotero.dir
|
// Set the locale direction to Zotero.dir
|
||||||
// DEBUG: is there a better way to get the entity from JS?
|
// DEBUG: is there a better way to get the entity from JS?
|
||||||
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
var xmlhttp = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||||
|
@ -1239,11 +1239,11 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js");
|
||||||
// If not enough available forms, use last one -- PluralForm.get() uses first by
|
// If not enough available forms, use last one -- PluralForm.get() uses first by
|
||||||
// default, but it's more likely that a localizer will translate the two English
|
// default, but it's more likely that a localizer will translate the two English
|
||||||
// strings with some plural form as the second one, so we might as well use that
|
// strings with some plural form as the second one, so we might as well use that
|
||||||
if (availableForms.length < PluralForm.numForms()) {
|
if (availableForms.length < this.pluralFormNumForms()) {
|
||||||
l10n = availableForms[availableForms.length - 1];
|
l10n = availableForms[availableForms.length - 1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
l10n = PluralForm.get(num, l10n);
|
l10n = this.pluralFormGet(num, l10n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=af-ZA
|
general.useragent.locale=af-ZA
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=ar
|
general.useragent.locale=ar
|
||||||
|
pluralRule=12
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=bg-BG
|
general.useragent.locale=bg-BG
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=ca-AD
|
general.useragent.locale=ca-AD
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=cs-CZ
|
general.useragent.locale=cs-CZ
|
||||||
|
pluralRule=8
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=da-DK
|
general.useragent.locale=da-DK
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=de
|
general.useragent.locale=de
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=el-GR
|
general.useragent.locale=el-GR
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=en-US
|
general.useragent.locale=en-US
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=es-ES
|
general.useragent.locale =es-ES
|
||||||
|
pluralRule = 1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=et-EE
|
general.useragent.locale=et-EE
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=eu-ES
|
general.useragent.locale=eu-ES
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=fa
|
general.useragent.locale=fa
|
||||||
|
pluralRule=0
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=fi-FI
|
general.useragent.locale=fi-FI
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=fr-FR
|
general.useragent.locale=fr-FR
|
||||||
|
pluralRule=2
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=gl-ES
|
general.useragent.locale=en-US
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=he-IL
|
general.useragent.locale=he-IL
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=hr-HR
|
general.useragent.locale=hr-HR
|
||||||
|
pluralRule=7
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=hu-HU
|
general.useragent.locale=hu-HU
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=id-ID
|
general.useragent.locale=id-ID
|
||||||
|
pluralRule=0
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=is-IS
|
general.useragent.locale=is-IS
|
||||||
|
pluralRule=15
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=it-IT
|
general.useragent.locale =it-IT
|
||||||
|
pluralRule = 1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=ja-JP
|
general.useragent.locale =ja-JP
|
||||||
|
pluralRule = 0
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=km
|
general.useragent.locale=km
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=ko-KR
|
general.useragent.locale=ko-KR
|
||||||
|
pluralRule=0
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=lt-LT
|
general.useragent.locale=lt-LT
|
||||||
|
pluralRule=6
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=mn-MN
|
general.useragent.locale=en-US
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=nb-NO
|
general.useragent.locale=nb-NO
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=nl-NL
|
general.useragent.locale=nl-NL
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=nn-NO
|
general.useragent.locale=nn-NO
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=pl-PL
|
general.useragent.locale=pl-PL
|
||||||
|
pluralRule=9
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=pt-BR
|
general.useragent.locale=pt-BR
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=pt-PT
|
general.useragent.locale=pt-PT
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=ro-RO
|
general.useragent.locale=ro-RO
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=ru-RU
|
general.useragent.locale =ru-RU
|
||||||
|
pluralRule = 7
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=sk-SK
|
general.useragent.locale=sk-SK
|
||||||
|
pluralRule=8
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=sl-SI
|
general.useragent.locale=sl-SI
|
||||||
|
pluralRule=10
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=sr-RS
|
general.useragent.locale=sr-RS
|
||||||
|
pluralRule=7
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=sv-SE
|
general.useragent.locale=sv-SE
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=th-TH
|
general.useragent.locale=th-TH
|
||||||
|
pluralRule=0
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=tr-TR
|
general.useragent.locale=tr-TR
|
||||||
|
pluralRule=0
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=uk-UA
|
general.useragent.locale=uk-UA
|
||||||
|
pluralRule=7
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=vi-VN
|
general.useragent.locale=vi-VN
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=zh-CN
|
general.useragent.locale=zh-CN
|
||||||
|
pluralRule=1
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
general.useragent.locale=zh-TW
|
general.useragent.locale=zh-TW
|
||||||
|
pluralRule=0
|
||||||
|
|
Loading…
Reference in a new issue