message string coding style (was: r13694 -
gnucash/trunk/src/report/report-gnome - )
Chris Shoemaker
c.shoemaker at cox.net
Fri Mar 24 21:37:44 EST 2006
On Fri, Mar 24, 2006 at 10:15:47AM +0100, Christian Stimming wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Chris,
>
> thanks a lot for implementing this. Yet another showstopper bug
> squashed! Great.
>
> However, your coding style concerning the message strings caught my eye.
> I already told hampton on IRC what the translators think about that, and
> I thought I should point out on the mailing list the implications for
> the translators, just for future reference. Your code looks like this:
>
> +static gboolean
> +remove_old_report(gpointer key, gpointer val, gpointer data)
> +{
> + /* ... */
> + gchar *msg, *str = _("Do you want to display '%s'?");
> + gint response;
> +
> + name = gnc_report_name(report);
> + msg = g_strdup_printf(str, name);
> + gtk_message_dialog_set_markup(dialog, msg);
> + /* ... */
> +}
Christian,
Thank you for explaining this. I'll change this case to:
msg = g_strdup_printf(_("Do you want to display '%s'?", name);
and the other case to:
msg = g_strdup_printf(
_("GnuCash has found %d reports from an earlier version of "
"GnuCash but can't tell which ones you had open. You will "
"now have the option to open each report or not. From now "
"on, GnuCash will remember which reports you leave open, so "
"you won't see this message again."), num_reports);
If there's anything else I can do to make GnuCash easier to translate,
please let me know. Thanks.
-chris
> Let me explain what this means to translators. Translators will see the
> string "Do you want to display '%s'?" in the gnucash.pot file. Then,
> they will wonder what this mysterious "%s" might be -- is it a verb, is
> it a number, is it the name of a picture, is it the name of whatever? So
> the translators will go into the source code file at the line number
> that is noted in the gnucash.pot file (pressing "s" in emacs po-mode).
> However, since you defined the string *not* inside the actual printf
> statement, it is now not at all obvious what the argument to the "%s"
> will be. The translator is forced to read through the whole function,
> looking for the place where this obnoxious "str" variable is used
> eventually. From a translator point of view this sucks. Royally. Please
> do *not* use this coding style.
>
> Instead, please use message strings always exactly in the function where
> it is used. Especially printf strings. But all others just as well.
> Especially because there's not at all any technical reason not to do so.
> That is why I emphasize the strong translator's reason: The translators
> need to see the exact context of the translation strings, and the easier
> this is, the better the translation will be. So please use dialog
> strings directly inside the printf and/or gtk_message_dialog_new() et al
> function. Thanks a lot.
>
> Christian
>
More information about the gnucash-devel
mailing list