translate / pootle

Online translation tool
http://pootle.translatehouse.org
GNU General Public License v3.0
1.48k stars 287 forks source link

False positive printf() check fail with plural texts where the singular text has no variables #3122

Open multiwebinc opened 10 years ago

multiwebinc commented 10 years ago

Version: 2.5.0

For example, if I have the plural text:

Singular: Arrange this tour for me Plural: Arrange these %d tours for me

No matter what the translators do, this will always fail the printf() check unless the target language has no plurals (e.g. Chinese). The printf() check should check both strings independently, singular with singular and plural with plural.

dwaynebailey commented 10 years ago

Thanks for the bug report.

(In reply to Mike Robinson from BZ-IMPORT::comment #0)

For example, if I have the plural text:

Singular: Arrange this tour for me Plural: Arrange these %d tours for me

Certainly in C Gettext the singular should also have %d, it varies with other languages using Gettext.

No matter what the translators do, this will always fail the printf() check unless the target language has no plurals (e.g. Chinese). The printf() check should check both strings independently, singular with singular and plural with plural.

Since the target language can have any number of plural forms, up to six for Arabic there is really no way to know which plurals should be compared to which string.

PS the checks can be marked as false positives. Not ideal as users rely on these checks and we don't want them to get into the habit of marking everything as a false positive.

friedelwolff commented 10 years ago

(In reply to Dwayne Bailey from BZ-IMPORT::comment #1)

Certainly in C Gettext the singular should also have %d, it varies with other languages using Gettext.

Just a note for when someone looks into this: I think I have seen things in GNOME where the singular doesn't contain a variable. This might be because they use a gettext function in glib rather than real gettext - not sure. Either way, we should probably compare with the code in gettext to be sure what msgfmt actually checks here.

khagaroth commented 10 years ago

(In reply to Dwayne Bailey from BZ-IMPORT::comment #1)

Certainly in C Gettext the singular should also have %d, it varies with other languages using Gettext.

Not really. Having the quantificator in the singular could make the string untranslatable (linguistically not technically) in some languages. Gettext supports this without any complaints.

Also note that this is a duplicate of 2736 under Translate Toolkit / Checks that was reported some 8 months ago.