When I enable Portuguese Language on my site, "0 votes" in poll nodes seems to be translated as "1 vote". I checked the string translation and everything seems fine... I have "%count votes" translated as "%count votos" and "1 vote" translated as "1 voto".

Why then does "0 votes" get turned into "1 voto" when Portuguese language is enabled? Seems like a bug.

See here for an example: http://www.abreojogo.com/node/226

Also, I can't be 100% sure of this, but %members seems to suffer the same problem. In the the "who's online" block I think "0 members" gets incorrectly translated into "1 membro".

Comments

killes@www.drop.org’s picture

I think the formula used to determine correct plural forms might be wrong. The formula is taken from the PO file during the upgrade and it is stored inside the locales_meta table.

ricmadeira’s picture

Thanks Killes!

On that table I have plurals=2 and formula=($n>1). I just don't known what that means... but I'll try to check the documentation.

Should we change this bug to the Portuguese Translation project then?

killes@www.drop.org’s picture

Project: Drupal core » Portuguese (Portugal) Translation
Version: 4.6.6 » 4.6.x-1.x-dev
Component: locale.module » Miscellaneous

Moving.

$n > 1 should probably be changed to $n != 0 && $n > 1.

ricmadeira’s picture

Project: Portuguese (Portugal) Translation » Drupal core
Version: 4.6.x-1.x-dev » 4.6.6
Component: Miscellaneous » locale.module

Great! It was really the plural formula, thanks!

I changed it to formula=(n!=1) and that seemed to do the trick. The number 0 is plural in Portuguese too.

Now I just have to check if this is correct in the portuguese.po file before closing the bug or submiting it there.

ricmadeira’s picture

Project: Drupal core » Portuguese (Portugal) Translation
Version: 4.6.6 » 4.6.x-1.x-dev
Component: locale.module » Code
Assigned: Unassigned » ricmadeira
Status: Active » Needs review

Oops, crossposted with Killes and doing so changed the bug back to the drupal Project. Moving back to the Portuguese translation.

Okay, so the code line "Plural-Forms: nplurals=2; plural=(n > 1);\n" in the portuguese.po file needs to be changed.

Which is better? "$n != 1" or what Killes suggested?

ricmadeira’s picture

Component: Code » Miscellaneous
Assigned: ricmadeira » Unassigned
mcduarte2000’s picture

Assigned: Unassigned » mcduarte2000

I'll look at this and correct it. Thanks for the feedback.

mcduarte2000’s picture

Status: Needs review » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)