i18next-gettext-converter: Wrong `Plural-Forms` for Brazilian Portuguese

Hi. Thanks for this great tools!

I have encountered an issue when trying to generate a PO file for Brazilian Portugal. This may be user, error, but this is what I see:

I run

./node_modules/.bin/i18next-conv -l pt_br -s hello.json -t hello.po

where hello.json is nothing more than { "Hello": "Olá" } and I get a PO file with

"Plural-Forms: nplurals=2; plural=(n != 1)\n"

The issue is that for Brazillian Portuguese it should be nplurals=( n > 1), and it is correct in plurals.json here https://github.com/i18next/i18next-gettext-converter/blob/master/src/lib/plurals.js#L494-L498

I have tried using pt-BR or pt-br but they both give me the regular Portuguese plural forms.

I suspect the problem is down to this line https://github.com/i18next/i18next-gettext-converter/blob/7ece5fc16bc121285925c18ef588d86440bb67ab/src/lib/gettext2json.js#L134

const ext = plurals.rules[locale.replace('_', '-').split('-')[0]];

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

@rankida i think / believe / guess unicode docs are wider used…that’s why i decided on using their favour 😉

rather sure http://www.unicode.org/cldr/charts/26/supplemental/language_plural_rules.html is right…it should be n > 1 for pt-BR