virtaal icon indicating copy to clipboard operation
virtaal copied to clipboard

Support for configuring "Plural-Forms"

Open fbobraga opened this issue 9 years ago • 7 comments

I'm using this tool to translate PO files to Brazilian Portuguese (pt_BR) - but the header of the translated files become:

"[...] Plural-Forms: nplurals=2; plural=(n != 1); [...]"

... from the correct (as noted in http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html), already in the files, value:

"[...] Plural-Forms: nplurals=2; plural=(n > 1); [...]"

Since the Virtaal tool seems to don't have the configuration for it (or I can't find it!), like in http://poedit.net/ (for example), how can I configure it to correctly handle the Plural-Forms info in the header of translated files? Is necessary to alter some setting in ~/.virtaal/virtaal.ini? In my virtaal.ini:

"[...] [language] [...] targetlang = pt_BR [...] plural = None [...]"

  • I'm using the 0.7.1 version of the tool

fbobraga avatar Apr 22 '15 16:04 fbobraga

I've tried to change my ~/.virtaal/virtaal.ini to:

"[...] [language] [...] plural = nplurals=2; plural=(n > 1); [...]"

... but it seems to have no effect (the value is not changed in the config file, but the behavior is the same) - I've tested it with the version in the Debian repo (0.7.1) and clonning the git (version "1.0.0-beta"), with the same results

fbobraga avatar Apr 22 '15 20:04 fbobraga

After a extensive search, I found that the error is in the repository 'translate', more specifically in translate/lang/data.py, which wrongly defines plural-form: 'pt_BR': (u'Portuguese (Brazil)', 2, '(n != 1)'),

It can be seen in https://github.com/translate/translate/blob/master/translate/lang/data.py

rffontenelle avatar Apr 23 '15 19:04 rffontenelle

I created a Pull Request in translate repository to fix this issue. You can view it in https://github.com/translate/translate/pull/3261

rffontenelle avatar Apr 23 '15 19:04 rffontenelle

moved to https://github.com/translate/translate/issues/3263

fbobraga avatar Apr 23 '15 21:04 fbobraga

@fbobraga These differences should be filed as an issue in https://github.com/translate/translate/issues

unho avatar Apr 24 '15 17:04 unho

Ich kehre zurück am 04.05.2015.

Dann werde ich mich um das Anliegen kümmern. Beste Grüße Knut Wenzig

Hinweis: Dies ist eine automatische Antwort auf Ihre Nachricht "Re: [virtaal] Support for configuring "Plural-Forms" (#3212)" gesendet am 04/24/2015 19:36:07.

Diese ist die einzige Benachrichtigung, die Sie empfangen werden, während diese Person abwesend ist.

kwenzig avatar Apr 24 '15 17:04 kwenzig

It affects also slovenian, where two "Plural-Forms" exist and it happens that some files use one string and other use the other one. Proposition: an already existing Plural-Forms string should not be changed (without warning).

beernarrd avatar May 26 '15 20:05 beernarrd