Skip to content

Missing pluralization forms #85

@MichaelHoste

Description

@MichaelHoste

We noticed that some pluralization forms are missing from here: https://github.com/ruby-gettext/gettext/blob/master/lib/gettext/tools/msginit.rb#L322

One of the important missing ones is Arabic.

I have 2 questions:

1. Rules importation

Would you accept a pull request that extend these rules using the CLDR official source extracted to valid GetText rules using this tool?

export-plural-rules prettyjson > file.json returns a file like this, and the idea would be to add it to this project and load the pluralization rules from it in the plural_forms method:

{
    "af": {
        "name": "Afrikaans",
        "formula": "n != 1",
        "plurals": 2,
        "cases": [
            "one",
            "other"
        ],
        "examples": {
            "one": "1",
            "other": "0, 2~16, 100, 1000, 10000, 100000, 1000000, …"
        }
    },
    "ak": {
        "name": "Akan",
        "formula": "n > 1",
        "plurals": 2,
        "cases": [
            "one",
            "other"
        ],
        "examples": {
            "one": "0, 1",
            "other": "2~17, 100, 1000, 10000, 100000, 1000000, …"
        }
    },
 ...
}

We could even simplify it to have a file like this:

{
    "af": {
        "formula": "n != 1",
        "plurals": 2
    },
    "ak": {
        "formula": "n > 1",
        "plurals": 2
    },
 ...
}

or even transform it into a Ruby hash. What would be your preference?

2. nplurals > 4

There are currently no more than 4 pluralization forms, and it will change with Arabic that needs 6 of them.

Do you expect that there will be problems with the rest of the code? Or just improving the plural_forms method will be enough to make it work with msgstr[4] and msgstr[5]?


Thank you for any feedback that you may have on this.

I am volunteering to work on this issue with your guidance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions