Mismatched c-format specifiers

View: New views
3 Messages — Rating Filter:   Alert me  

Mismatched c-format specifiers

by Mark Doliner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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>

It IS possible to change the order of c-format specifiers.
Information on how to do that can be found here:
http://www.gnu.org/software/gettext/manual/gettext.html#c_002dformat-Flag

We "fixed" a few of these problems in 2.6.2 by marking the strings as
fuzzy, which should cause them to not be used.  If you're the
translator for one of these languages you may want to grab a copy of
your translation from our repo before you start translating for the
next release (not currently scheduled, hopefully at least 3 weeks
away):  bn el mn zh_CN

Thanks!
-Mark
_______________________________________________
Translators mailing list
Translators@...
http://pidgin.im/cgi-bin/mailman/listinfo/translators

Re: Mismatched c-format specifiers

by F Wolff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

--
Recently on my blog:
http://translate.org.za/blogs/friedel/en/content/support-afrikaans-google-translate

_______________________________________________
Translators mailing list
Translators@...
http://pidgin.im/cgi-bin/mailman/listinfo/translators

Re: Mismatched c-format specifiers

by Mark Doliner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Sep 9, 2009 at 9:09 AM, F Wolff <friedel@...> 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
_______________________________________________
Translators mailing list
Translators@...
http://pidgin.im/cgi-bin/mailman/listinfo/translators