www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 521f291b844f10998aa190855d92f7b0f7fe5e61
parent c2234176aad1d6a015f742b6af6087b567328905
Author: Dan Stillman <dstillman@zotero.org>
Date:   Tue, 25 Jul 2017 15:20:23 -0400

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.

Diffstat:
Mchrome/content/zotero/xpcom/zotero.js | 18+++++++++---------
Mchrome/locale/af-ZA/zotero/mozilla/intl.properties | 1+
Mchrome/locale/ar/zotero/mozilla/intl.properties | 1+
Mchrome/locale/bg-BG/zotero/mozilla/intl.properties | 1+
Mchrome/locale/ca-AD/zotero/mozilla/intl.properties | 1+
Mchrome/locale/cs-CZ/zotero/mozilla/intl.properties | 1+
Mchrome/locale/da-DK/zotero/mozilla/intl.properties | 1+
Mchrome/locale/de/zotero/mozilla/intl.properties | 1+
Mchrome/locale/el-GR/zotero/mozilla/intl.properties | 1+
Mchrome/locale/en-US/zotero/mozilla/intl.properties | 1+
Mchrome/locale/es-ES/zotero/mozilla/intl.properties | 3++-
Mchrome/locale/et-EE/zotero/mozilla/intl.properties | 1+
Mchrome/locale/eu-ES/zotero/mozilla/intl.properties | 1+
Mchrome/locale/fa/zotero/mozilla/intl.properties | 1+
Mchrome/locale/fi-FI/zotero/mozilla/intl.properties | 1+
Mchrome/locale/fr-FR/zotero/mozilla/intl.properties | 1+
Mchrome/locale/gl-ES/zotero/mozilla/intl.properties | 3++-
Mchrome/locale/he-IL/zotero/mozilla/intl.properties | 1+
Mchrome/locale/hr-HR/zotero/mozilla/intl.properties | 1+
Mchrome/locale/hu-HU/zotero/mozilla/intl.properties | 1+
Mchrome/locale/id-ID/zotero/mozilla/intl.properties | 1+
Mchrome/locale/is-IS/zotero/mozilla/intl.properties | 1+
Mchrome/locale/it-IT/zotero/mozilla/intl.properties | 3++-
Mchrome/locale/ja-JP/zotero/mozilla/intl.properties | 3++-
Mchrome/locale/km/zotero/mozilla/intl.properties | 1+
Mchrome/locale/ko-KR/zotero/mozilla/intl.properties | 1+
Mchrome/locale/lt-LT/zotero/mozilla/intl.properties | 1+
Mchrome/locale/mn-MN/zotero/mozilla/intl.properties | 3++-
Mchrome/locale/nb-NO/zotero/mozilla/intl.properties | 1+
Mchrome/locale/nl-NL/zotero/mozilla/intl.properties | 1+
Mchrome/locale/nn-NO/zotero/mozilla/intl.properties | 1+
Mchrome/locale/pl-PL/zotero/mozilla/intl.properties | 1+
Mchrome/locale/pt-BR/zotero/mozilla/intl.properties | 1+
Mchrome/locale/pt-PT/zotero/mozilla/intl.properties | 1+
Mchrome/locale/ro-RO/zotero/mozilla/intl.properties | 1+
Mchrome/locale/ru-RU/zotero/mozilla/intl.properties | 3++-
Mchrome/locale/sk-SK/zotero/mozilla/intl.properties | 1+
Mchrome/locale/sl-SI/zotero/mozilla/intl.properties | 1+
Mchrome/locale/sr-RS/zotero/mozilla/intl.properties | 1+
Mchrome/locale/sv-SE/zotero/mozilla/intl.properties | 1+
Mchrome/locale/th-TH/zotero/mozilla/intl.properties | 1+
Mchrome/locale/tr-TR/zotero/mozilla/intl.properties | 1+
Mchrome/locale/uk-UA/zotero/mozilla/intl.properties | 1+
Mchrome/locale/vi-VN/zotero/mozilla/intl.properties | 1+
Mchrome/locale/zh-CN/zotero/mozilla/intl.properties | 1+
Mchrome/locale/zh-TW/zotero/mozilla/intl.properties | 1+
46 files changed, 60 insertions(+), 15 deletions(-)

diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js @@ -225,18 +225,18 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); Zotero.browser = "g"; // Get resolved locale - this.locale = Services.strings.createBundle("chrome://zotero/locale/mozilla/intl.properties") - .GetStringFromName("general.useragent.locale"); - - _localizedStringBundle = Services.strings.createBundle("chrome://zotero/locale/zotero.properties"); - // Fix logged error in PluralForm.jsm when numForms() is called before get(), as it is in - // 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') + 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.pluralFormGet = get; + this.pluralFormNumForms = numForms; // Also load the brand as appName var brandBundle = Services.strings.createBundle("chrome://branding/locale/brand.properties"); this.appName = brandBundle.GetStringFromName("brandShortName"); + _localizedStringBundle = Services.strings.createBundle("chrome://zotero/locale/zotero.properties"); + // Set the locale direction to Zotero.dir // DEBUG: is there a better way to get the entity from JS? 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 // 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 - if (availableForms.length < PluralForm.numForms()) { + if (availableForms.length < this.pluralFormNumForms()) { l10n = availableForms[availableForms.length - 1]; } else { - l10n = PluralForm.get(num, l10n); + l10n = this.pluralFormGet(num, l10n); } } } diff --git a/chrome/locale/af-ZA/zotero/mozilla/intl.properties b/chrome/locale/af-ZA/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=af-ZA +pluralRule=1 diff --git a/chrome/locale/ar/zotero/mozilla/intl.properties b/chrome/locale/ar/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=ar +pluralRule=12 diff --git a/chrome/locale/bg-BG/zotero/mozilla/intl.properties b/chrome/locale/bg-BG/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=bg-BG +pluralRule=1 diff --git a/chrome/locale/ca-AD/zotero/mozilla/intl.properties b/chrome/locale/ca-AD/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=ca-AD +pluralRule=1 diff --git a/chrome/locale/cs-CZ/zotero/mozilla/intl.properties b/chrome/locale/cs-CZ/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=cs-CZ +pluralRule=8 diff --git a/chrome/locale/da-DK/zotero/mozilla/intl.properties b/chrome/locale/da-DK/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=da-DK +pluralRule=1 diff --git a/chrome/locale/de/zotero/mozilla/intl.properties b/chrome/locale/de/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=de +pluralRule=1 diff --git a/chrome/locale/el-GR/zotero/mozilla/intl.properties b/chrome/locale/el-GR/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=el-GR +pluralRule=1 diff --git a/chrome/locale/en-US/zotero/mozilla/intl.properties b/chrome/locale/en-US/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=en-US +pluralRule=1 diff --git a/chrome/locale/es-ES/zotero/mozilla/intl.properties b/chrome/locale/es-ES/zotero/mozilla/intl.properties @@ -1 +1,2 @@ -general.useragent.locale=es-ES +general.useragent.locale =es-ES +pluralRule = 1 diff --git a/chrome/locale/et-EE/zotero/mozilla/intl.properties b/chrome/locale/et-EE/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=et-EE +pluralRule=1 diff --git a/chrome/locale/eu-ES/zotero/mozilla/intl.properties b/chrome/locale/eu-ES/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=eu-ES +pluralRule=1 diff --git a/chrome/locale/fa/zotero/mozilla/intl.properties b/chrome/locale/fa/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=fa +pluralRule=0 diff --git a/chrome/locale/fi-FI/zotero/mozilla/intl.properties b/chrome/locale/fi-FI/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=fi-FI +pluralRule=1 diff --git a/chrome/locale/fr-FR/zotero/mozilla/intl.properties b/chrome/locale/fr-FR/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=fr-FR +pluralRule=2 diff --git a/chrome/locale/gl-ES/zotero/mozilla/intl.properties b/chrome/locale/gl-ES/zotero/mozilla/intl.properties @@ -1 +1,2 @@ -general.useragent.locale=gl-ES +general.useragent.locale=en-US +pluralRule=1 diff --git a/chrome/locale/he-IL/zotero/mozilla/intl.properties b/chrome/locale/he-IL/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=he-IL +pluralRule=1 diff --git a/chrome/locale/hr-HR/zotero/mozilla/intl.properties b/chrome/locale/hr-HR/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=hr-HR +pluralRule=7 diff --git a/chrome/locale/hu-HU/zotero/mozilla/intl.properties b/chrome/locale/hu-HU/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=hu-HU +pluralRule=1 diff --git a/chrome/locale/id-ID/zotero/mozilla/intl.properties b/chrome/locale/id-ID/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=id-ID +pluralRule=0 diff --git a/chrome/locale/is-IS/zotero/mozilla/intl.properties b/chrome/locale/is-IS/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=is-IS +pluralRule=15 diff --git a/chrome/locale/it-IT/zotero/mozilla/intl.properties b/chrome/locale/it-IT/zotero/mozilla/intl.properties @@ -1 +1,2 @@ -general.useragent.locale=it-IT +general.useragent.locale =it-IT +pluralRule = 1 diff --git a/chrome/locale/ja-JP/zotero/mozilla/intl.properties b/chrome/locale/ja-JP/zotero/mozilla/intl.properties @@ -1 +1,2 @@ -general.useragent.locale=ja-JP +general.useragent.locale =ja-JP +pluralRule = 0 diff --git a/chrome/locale/km/zotero/mozilla/intl.properties b/chrome/locale/km/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=km +pluralRule=1 diff --git a/chrome/locale/ko-KR/zotero/mozilla/intl.properties b/chrome/locale/ko-KR/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=ko-KR +pluralRule=0 diff --git a/chrome/locale/lt-LT/zotero/mozilla/intl.properties b/chrome/locale/lt-LT/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=lt-LT +pluralRule=6 diff --git a/chrome/locale/mn-MN/zotero/mozilla/intl.properties b/chrome/locale/mn-MN/zotero/mozilla/intl.properties @@ -1 +1,2 @@ -general.useragent.locale=mn-MN +general.useragent.locale=en-US +pluralRule=1 diff --git a/chrome/locale/nb-NO/zotero/mozilla/intl.properties b/chrome/locale/nb-NO/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=nb-NO +pluralRule=1 diff --git a/chrome/locale/nl-NL/zotero/mozilla/intl.properties b/chrome/locale/nl-NL/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=nl-NL +pluralRule=1 diff --git a/chrome/locale/nn-NO/zotero/mozilla/intl.properties b/chrome/locale/nn-NO/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=nn-NO +pluralRule=1 diff --git a/chrome/locale/pl-PL/zotero/mozilla/intl.properties b/chrome/locale/pl-PL/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=pl-PL +pluralRule=9 diff --git a/chrome/locale/pt-BR/zotero/mozilla/intl.properties b/chrome/locale/pt-BR/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=pt-BR +pluralRule=1 diff --git a/chrome/locale/pt-PT/zotero/mozilla/intl.properties b/chrome/locale/pt-PT/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=pt-PT +pluralRule=1 diff --git a/chrome/locale/ro-RO/zotero/mozilla/intl.properties b/chrome/locale/ro-RO/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=ro-RO +pluralRule=1 diff --git a/chrome/locale/ru-RU/zotero/mozilla/intl.properties b/chrome/locale/ru-RU/zotero/mozilla/intl.properties @@ -1 +1,2 @@ -general.useragent.locale=ru-RU +general.useragent.locale =ru-RU +pluralRule = 7 diff --git a/chrome/locale/sk-SK/zotero/mozilla/intl.properties b/chrome/locale/sk-SK/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=sk-SK +pluralRule=8 diff --git a/chrome/locale/sl-SI/zotero/mozilla/intl.properties b/chrome/locale/sl-SI/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=sl-SI +pluralRule=10 diff --git a/chrome/locale/sr-RS/zotero/mozilla/intl.properties b/chrome/locale/sr-RS/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=sr-RS +pluralRule=7 diff --git a/chrome/locale/sv-SE/zotero/mozilla/intl.properties b/chrome/locale/sv-SE/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=sv-SE +pluralRule=1 diff --git a/chrome/locale/th-TH/zotero/mozilla/intl.properties b/chrome/locale/th-TH/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=th-TH +pluralRule=0 diff --git a/chrome/locale/tr-TR/zotero/mozilla/intl.properties b/chrome/locale/tr-TR/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=tr-TR +pluralRule=0 diff --git a/chrome/locale/uk-UA/zotero/mozilla/intl.properties b/chrome/locale/uk-UA/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=uk-UA +pluralRule=7 diff --git a/chrome/locale/vi-VN/zotero/mozilla/intl.properties b/chrome/locale/vi-VN/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=vi-VN +pluralRule=1 diff --git a/chrome/locale/zh-CN/zotero/mozilla/intl.properties b/chrome/locale/zh-CN/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=zh-CN +pluralRule=1 diff --git a/chrome/locale/zh-TW/zotero/mozilla/intl.properties b/chrome/locale/zh-TW/zotero/mozilla/intl.properties @@ -1 +1,2 @@ general.useragent.locale=zh-TW +pluralRule=0