Update the internationalization answer. (#340951, Kristof Versant)

2006-05-08  Matthias Clasen  <mclasen@redhat.com>

	* gtk/question_index.sgml (reference): Update the internationalization
	answer.  (#340951, Kristof Versant)
This commit is contained in:
Matthias Clasen 2006-05-08 13:55:24 +00:00 committed by Matthias Clasen
parent 171e1115f2
commit 18c7fb2f44
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2006-05-08 Matthias Clasen <mclasen@redhat.com>
* gtk/question_index.sgml (reference): Update the internationalization
answer. (#340951, Kristof Versant)
2006-05-04 Matthias Clasen <mclasen@redhat.com>
* === Released 2.9.0 ===

View File

@ -205,13 +205,15 @@ You eventually have to call gettext() on the string to actually fetch the
translation. _() both marks the string for translation and actually translates it.
</para>
<para>
Nowadays, GLib provides the common shorthand macros in the header file
<filename>gi18n.h</filename>, so you don't have to define them yourself, just
include that header.
</para>
<para>
Code using these macros ends up looking like this:
<informalexample>
<programlisting>
#include &lt;libintl.h&gt;
#define _(x) gettext (x)
#define N_(x) x
#include &lt;gi18n.h&gt;
static const char *global_variable = N_("Translate this string");
@ -238,6 +240,11 @@ of using the default.For dgettext() the _() macro can be defined as:
</programlisting>
</informalexample>
</para>
<para>
Again, GLib comes with the <filename>gi18n-lib.h</filename>, saving you the trouble
of defining the macros by hand. The macros in that header expect the translation
domain to be specified by the %GETTEXT_PACKAGE macro.
</para>
</answer>
</qandaentry>