Skip to content

Plurals don't work for i18n package #2700

@tfmorris

Description

@tfmorris

Describe the bug

The i18n package is missing the CLD rule parser, so plurals don't work for many languages.

To Reproduce
Per #1858 (comment)

$.i18n().locale = 'en';
$.i18n("$1 de $2 {{plural:$2|page|pages}}", 5, 10);
$.i18n().locale = 'fr';
$.i18n("$1 de $2 {{plural:$2|page|pages}}", 5, 10);

The last line gives this:

project-bundle.js:28751 Uncaught ReferenceError: pluralRuleParser is not defined
    at Object.getPluralForm (project-bundle.js:28751)
    at Object.convertPlural (project-bundle.js:28751)
    at Object.plural (project-bundle.js:28744)
    at Object.emit (project-bundle.js:28744)
    at project-bundle.js:28744
    at Function.map (project-bundle.js:504)
    at Object.emit (project-bundle.js:28744)
    at Object.parse (project-bundle.js:28739)
    at a.parse (project-bundle.js:28723)
    at Function.e.i18n (project-bundle.js:28723)

Proposed solution
Include https://github.com/santhoshtr/CLDRPluralRuleParser/blob/8baf9aedc428924fe6ee508b3d952cb5564efb3a/src/CLDRPluralRuleParser.js
(and perhaps https://github.com/santhoshtr/CLDRPluralRuleParser/blob/8baf9aedc428924fe6ee508b3d952cb5564efb3a/data/plurals.json)

(check for the appropriate version to match the version of Wikimedia i18n that we're using)

OpenRefine:

  • Version 3.4 beta - current master

Metadata

Metadata

Assignees

Labels

Priority: HighDenotes issues that require urgent attention and may be blocking progress.Type: BugIssues related to software defects or unexpected behavior, which require resolution.localizationanything to do with i18n Internationalization and I10n localization

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions