2011/4/17 Jonathan Nieder <[email protected]>:
> Felipe E. F. de Castro wrote:
>
>> In the file cg_print.c, there is a translatable string which makes
>> gettext think it is in C-format, while in fact it is not:
>>
>> _("%time")
>
> The gettext manual ("info gettext") says the following:
>
> `xgettext' of course could make a wrong decision the other way
> round, i.e. a string marked as a format string actually is not a format
> string. In this case the `msgfmt' might give too many warnings and
> would prevent translating the `.po' file. The method to prevent this
> wrong decision is similar to the one used above, only the comment to
> use must contain the string `xgettext:no-c-format'.
>
> So I suppose a comment like so:
>
> /* xgettext:no-c-format */
>
> on the line before might help. Could you try that and see?
Oh, very nice, it worked. But it has a little detail there: you should
put the comment just before the translatable marked string. And in
order to do that, you have to break the indentation in another way.
See what I mean in the attached diff file, ok?
*** cg_print.c 2011-04-18 20:34:00.309575533 -0300
--- cg_print_modified.c 2011-04-18 20:32:49.685603137 -0300
***************
*** 94,101 ****
{
printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s %-8.8s\n",
"", "", "", "", _("called"), _("total"), _("parents"));
! printf ("%-6.6s %5.5s %7.7s %11.11s %7.7s+%-7.7s %-8.8s\t%5.5s\n",
! _("index"), _("%time"), _("self"), _("descendants"),
_("called"), _("self"), _("name"), _("index"));
printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s %-8.8s\n",
"", "", "", "", _("called"), _("total"), _("children"));
--- 94,102 ----
{
printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s %-8.8s\n",
"", "", "", "", _("called"), _("total"), _("parents"));
! printf ("%-6.6s %5.5s %7.7s %11.11s %7.7s+%-7.7s %-8.8s\t%5.5s\n", _("index"),
! /* xgettext:no-c-format */
! _("%time"), _("self"), _("descendants"),
_("called"), _("self"), _("name"), _("index"));
printf ("%6.6s %5.5s %7.7s %11.11s %7.7s/%-7.7s %-8.8s\n",
"", "", "", "", _("called"), _("total"), _("children"));