"Richard W.M. Jones" <rjones(a)redhat.com> wrote:
On Fri, Mar 28, 2008 at 12:15:04PM +0100, Jim Meyering wrote:
> But there's nothing we can do about the latter, and there *is* something
> we can do about the former: precede with "%s". Of course, gettext tools
> like msgmerge are careful to ensure that %-directives in translations
> match those in the original, so it's not a problem, in general.
Does msgmerge distinguish between ordinary strings and format strings,
eg. puts (_("SQL lets you write LIKE '%string%'")); ?
Yes, though actually it's xgettext that does the checking,
and you tell it which functions take format strings and how.
Here's part of coreutils' bootstrap.conf:
# Additional xgettext options to use. Use "\\\newline" to break lines.
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
--from-code=UTF-8\\\
--flag=asprintf:2:c-format\\\
--flag=asnprintf:3:c-format\\\
--flag=error:3:c-format\\\
--flag=error_at_line:5:c-format\\\
--flag=vasprintf:2:c-format\\\
--flag=vasnprintf:3:c-format\\\
--flag=wrapf:1:c-format\\\
--flag=xasprintf:1:c-format\\\
--flag=xfprintf:2:c-format\\\
--flag=xprintf:1:c-format\\\
'
libvirt could use something similar.
This is yet another reason to try to avoid adding a
new error-printing function per subsystem.