> On Jan 8, 2016, at 1:39 AM, Geert Janssens <[email protected]> wrote: > > On Friday 01 January 2016 19:21:49 Frank H. Ellenberger wrote: >> Updated via https://github.com/Gnucash/gnucash/commit/c2598f89 >> (commit) from https://github.com/Gnucash/gnucash/commit/b4f39ebf >> (commit) >> >> >> >> commit c2598f89c59c5f44640e4b924222f6f224b7e372 >> Author: fell <[email protected]> >> Date: Sat Jan 2 01:21:42 2016 +0100 >> >> Add a missing gettext in plugin page owner tree >> >> Thanks to Mechtilde on IRC >> >> diff --git a/src/business/business-gnome/gnc-plugin-page-owner-tree.c >> b/src/business/business-gnome/gnc-plugin-page-owner-tree.c index >> 1faa339..84d8530 100644 >> --- a/src/business/business-gnome/gnc-plugin-page-owner-tree.c >> +++ b/src/business/business-gnome/gnc-plugin-page-owner-tree.c >> @@ -626,7 +626,7 @@ gnc_plugin_page_owner_tree_create_widget >> (GncPluginPage *plugin_page) "show-column-menu", TRUE, NULL); >> >> - g_object_set(G_OBJECT(plugin_page), "page-name", label, NULL); >> + g_object_set(G_OBJECT(plugin_page), "page-name", _(label), NULL); >> >> priv->tree_view = tree_view; >> selection = gtk_tree_view_get_selection(tree_view); >> >> >> >> Summary of changes: >> src/business/business-gnome/gnc-plugin-page-owner-tree.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> > > Frank, > > I'm not sure this is the right solution to the problem. Instead of marking > the variable name as > translatable I'd be inclined to mark the label definitions themselves as > translatable. These are a > few lines up in the code and currently set as N_(...). We could change them > there to _(...) to > avoid marking a variable instead of a constant as translatable. > > What do you think ?
They're effectively equivalent, see http://wiki.gnucash.org/wiki/Translation#How_to_make_strings_in_code_translatable. In both cases it's the constant that's marked as translatable. xgettext knows not to put an identifier in a potfile. With Frank's way the message catalog is searched only once at runtime for the label that's actually needed instead of four times for all of the possibilities. However, I think that it's premature optimization because label = _("foo"); bar(baz, label); is a bit more idiomatic. Regards, John Ralls _______________________________________________ gnucash-devel mailing list [email protected] https://lists.gnucash.org/mailman/listinfo/gnucash-devel
