Open paulschreiber opened 2 months ago
I am not sure if this:
When converting from JSON to PO, all underscores are treated as plurals.
If we have some JSON like this:
{ "welcome": { "title": "hello", "hello_world": "yay", "sample_one": "{{count}} shoe", "sample_other": "{{count}} shoes" }, "soil": { "bedrock": "Bedrock", "rock_fragment": { "VOLUME_0_1": "0–1%", "VOLUME_1_60": "35–60%", "VOLUME_60": ">60%" } } }
It converts to PO like this:
msgctxt "0" msgid "soil##rock##VOLUME" msgstr "0–1%" msgctxt "1" msgid "soil##rock##VOLUME" msgid_plural "soil##rock##VOLUME" msgstr[0] "" msgstr[1] "35–60%" msgid "welcome##title" msgstr "hello" msgid "soil##bedrock" msgstr "Bedrock" msgid "soil##rock##VOLUME" msgid_plural "soil##rock##VOLUME" msgstr[0] "" msgstr[1] ">60%" msgctxt "world" msgid "welcome##hello" msgstr "yay" msgctxt "one" msgid "welcome##sample" msgstr "{{count}} shoe" msgctxt "other" msgid "welcome##sample" msgstr "{{count}} shoes"
i18next-conv i18next-conv -l en -s en.json -t en.po
If this is expected bahviour, is there a way to get the behaviour I describe? I noted this option
.option('-P, --plurals <path>', 'Specify path to plural forms definitions')
But can't find an example of what that file should look like or how it behaves.
Only keys ending in _one and _other are treated as plurals
_one
_other
resulting in po like this:
msgid "soil##rock_fragment##VOLUME_0_1" msgstr "0–1%" msgid "soil##rock_fragment##VOLUME_35_60" msgstr[1] "35–60%" msgid "soil##rock_fragment##VOLUME_60" msgstr[1] ">60%" msgid "welcome##title" msgstr "hello" msgid "soil##bedrock" msgstr "Bedrock" msgid "welcome##hello_world" msgstr "yay" msgctxt "one" msgid "welcome##sample" msgstr "{{count}} shoe" msgctxt "other" msgid "welcome##sample" msgstr "{{count}} shoes"
I was able to work around this with these options:
ctxSeparator: '', compatibilityJSON: 'v4',
🐛 Bug Report
I am not sure if this:
When converting from JSON to PO, all underscores are treated as plurals.
To Reproduce
If we have some JSON like this:
It converts to PO like this:
If this is expected bahviour, is there a way to get the behaviour I describe? I noted this option
But can't find an example of what that file should look like or how it behaves.
Expected behavior
Only keys ending in
_one
and_other
are treated as pluralsresulting in po like this:
Your Environment