[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [patch] l10n crashes

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-09-03 20:56:06 CEST

Max Bowsher wrote:
> Branko Čibej wrote:
>>
>> I thought the gettext tools could verify that the format strings in the
>> translated messages are correct? If they can, we should do this checking
>> in a post-commit hook.
>
> The problem is that they only check strings which xgettext has
> heuristically determined to be format strings.
>
> One major category which is not getting checked properly is:
>
> some_printf_like_function (_("Just a plain string with no format
> characters));
>
> Now, if a translation accidentally adds a % code, .... CRASH.
>
>
> Not sure how best we can solve this.

Well, GNU xgettext (v0.14.1) has a "--flag" option for this. Here are such
options covering all of the functions on which we have put "__attribute__
((format(...)))":

   --flag=svn_cmdline_printf:2:c-format
   --flag=svn_cmdline_fprintf:3:c-format
   --flag=svn_error_createf:3:c-format
   --flag=svn_error_wrap_apr:2:c-format
   --flag=svn_stream_printf:3:c-format
   --flag=svn_stream_printf_from_utf8:4:c-format
   --flag=svn_string_createf:2:c-format
   --flag=svn_string_createv:2:c-format
   --flag=svn_stringbuf_createf:2:c-format
   --flag=svn_stringbuf_createv:2:c-format
   --flag=dav_svn__send_xml:3:c-format
   --flag=svn_fs_bdb__dberrf:3:c-format

And for any odd cases of a format string appearing in a non-standard place, we
can write "/* xgettext:c-format */" on the preceding line.

I am no expert on this; I just took a look in the manual ("info gettext").

Can you add those options into the build system so that they can be used
easily? I don't know where they would go.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Sep 3 20:56:56 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.