[PATCH] Add back translation support in combo boxes

John Ralls jralls at ceridwen.us
Wed Jul 3 09:57:44 EDT 2013

On Jul 3, 2013, at 5:52 AM, Geert Janssens <janssens-geert at telenet.be> wrote:

> On 03-07-13 14:34, Aurimas Fišeras wrote:
>> 2013.07.03 15:26, Geert Janssens rašė:
>>> Hi Aurimas,
>>> Thanks for the patch.
>>> I have looked at it but didn't apply it yet. My knowledge of gettext is
>>> limited, but it looks odd to me to wrap a variable inside the _() macro.
>>> I noticed this was the same in the old code you refer to, but I don't
>>> know if this is correct or not. Perhaps someone with a better
>>> understanding of gettext can give his opinion ?
>>> Geert
>> Hello,
>> check the manual for explanation:
>> https://developer.gnome.org/glib/2.30/glib-I18N.html#gettext-macro
> I did, but I still wasn't sure. So I'll leave this to someone else to properly evaluate.

The _() macro just calls gettext(), which takes the passed-in string, compares it against the
appropriate message catalog, and returns a translation if it finds one, and the provided string
if it doesn't.

So passing a variable to _() is fine. The potential problem is the other use of _() -- or gettext() --
which is to flag an enclosed string constant for xgettext to extract and include in the pot file.

I don't see where that part is done, but if it is somewhere, then there's no gettext problem.

There's a typo in the patch:
> +                                (description && *description) ?_(description) : "", -1);
should be
> +                                (description && *description) ? _(description) : "", -1);
(Note the space after the question mark).

John Ralls

More information about the gnucash-devel mailing list