Mismatched c-format specifiers

Mark Doliner mark at kingant.net
Fri Dec 4 02:46:53 EST 2009


On Wed, Sep 9, 2009 at 9:09 AM, F Wolff <friedel at translate.org.za> wrote:
> Op Ma, 2009-09-07 om 18:29 -0700 skryf Mark Doliner:
>> Hi!
>>
>> Elliott 'QuLogic' Sales de Andrade noticed that a few of our
>> translations had mismatched format specifiers (the %s and %d bits in
>> some strings).  This can cause a crash when the string is formatted.
>> For example, if you simply change the order of %s and %d then Pidgin
>> will try to print a number as a string, which is bad.  This email is a
>> friendly reminder to please be careful with c-format strings.
>>
>> You can run the check_po.pl script to detect these problems.  This
>> script can be found in the po/ subdirectory of the Pidgin source code.
>> > check_po.pl <your_language.po>
>
> What does this do differently than msgfmt -cv?   All translators should
> be checking that before submitting translations.  To my best knowledge,
> in the GNOME project there is a pre-commit hook to disallow commits
> of .po files that don't pass msgfmt -cv.
>
> Apart from avoiding crashing situations, I would encourage translators
> to also look at pofilter which allows for testing several other issues
> that might help to improve quality:
> http://translate.sourceforge.net/wiki/toolkit/pofilter
>
> Keep well
> Friedel

Hi Friedel, sorry for not responding earlier.

Yes, you could certainly use msgfmt -cv.  In fact, that is probably
easier--the output is more succinct.  I think check_po.pl does a few
additional checks, some of which you might not want.  Like making sure
translated strings have the same leading and trailing whitespace as
the English string.

-Mark


More information about the Translators mailing list