arb-converter-cli icon indicating copy to clipboard operation
arb-converter-cli copied to clipboard

Incorrect arb output from json with plurals

Open orestesgaolin opened this issue 4 years ago • 2 comments

Consider following json file:

{
    "button_pressed": {
        "one": "You pressed button once",
        "other": "You have pressed button {count} times"
    },
    "hello_name": "Hello {name}!"
}

The converted arb via following command has wrong format:

arb-converter to-arb ~/Downloads/json --from-hierarchical-json ~/Downloads/arb/

Output arb:

{
    "@@last_modified": "2020-02-17T21:21:02.388Z",
    "@@author": "arb-converter-cli",
    "button_pressed": {
        "one": "You pressed button once",
        "other": "You have pressed button {count} times"
    },
    "hello_name": "Hello {name}!"
}

Whereas correct file should look more or less like follows:

{
    "@@last_modified": "2020-02-17T21:21:02.388Z",
    "@@author": "arb-converter-cli",
    "button_pressed": "{count, plural, one{You have pressed button once} other{You have pressed button {count} times}}",
    "hello_name": "Hello {name}!"
}

Is there any chance for such support?

orestesgaolin avatar Feb 17 '20 21:02 orestesgaolin

Alternative form of json file could be as follows (exported from POEditor):

[
    {
        "term": "button_pressed",
        "definition": {
            "one": "You pressed button once",
            "other": "You have pressed button {count} times"
        },
        "context": "",
        "term_plural": "button_pressed_pl",
        "reference": "",
        "comment": ""
    },
    {
        "term": "hello_name",
        "definition": "Hello {name}!",
        "context": "",
        "term_plural": "",
        "reference": "",
        "comment": ""
    }
]

orestesgaolin avatar Feb 17 '20 21:02 orestesgaolin

Ooops totally missed that feature! Good catch @orestesgaolin !

jorgecoca avatar Feb 19 '20 22:02 jorgecoca