Checking c-format errors
- From: Matthias Clasen <mclasen redhat com>
- To: gnome-i18n gnome org
- Subject: Checking c-format errors
- Date: Thu, 08 Sep 2005 06:11:06 +0400
Before 2.8.0, I changed the gtk+/po/Makefile to call msgfmt -c to
catch errors in printf format translations. I was surprised to learn
that another such error is present in ro.po in 2.8.3. The bug is that
the translation has a %s, while the original string doesn't.
msgfmt did not catch this one, since the string wasn't marked as
c-format. Investigating this, I found that xgettext has no chance
to recognize a string as c-format unless it is passed to one of
the standard printf-like functions, or contains % placeholders.
What I ended up doing is adding the following flags to the
xgettext call in po/Makefile.in.in:
--flag=g_strdup_printf:1:c-format \
--flag=g_string_printf:2:c-format \
--flag=g_string_append_printf:2:c-format \
--flag=g_error_new:3:c-format \
--flag=g_set_error:4:c-format \
--flag=g_markup_printf_escaped:1:c-format \
--flag=g_log:3:c-format \
--flag=g_print:1:c-format \
--flag=g_printerr:1:c-format \
--flag=g_printf:1:c-format \
--flag=g_fprintf:2:c-format \
--flag=g_sprintf:2:c-format \
--flag=g_snprintf:3:c-format \
--flag=g_scanner_error:2:c-format \
--flag=g_scanner_warn:2:c-format \
--flag=gtk_message_dialog_format_secondary_markup:2:c-format \
--flag=gtk_message_dialog_format_secondary_text:2:c-format \
--flag=gtk_message_dialog_new:5:c-format \
--flag=gtk_message_dialog_new_with_markup:5:c-format \
to inform xgettext about all the printf-like functions in
GLib and GTK+.
I thought this hint might be interesting for others.
Regards, Matthias
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]