Re: [Vala] libraries and gettext



On Sat, 2013-04-20 at 23:28 +0200, rastersoft wrote:
Hi all:

I'm creating a library with Vala, and want to use gettext with it. In
normal programs it works the syntax _("text to translate"), but in a
library, dgettext() must be used. Is there a replacement for dgettext()
like the underscore for gettext?

Take a look at
https://developer.gnome.org/glib/stable/glib-I18N.html#glib-I18N.description

Basically, you still use _, you just need to define GETTEXT_PACKAGE.  If
you're compiling directly with valac, pass -X -DGETTEXT_PACKAGE=foo.  If
you're using a build system you need to include -DGETTEXT_PACKAGE=foo in
your cflags.


-Evan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]