85
85
GLib doesn't force any particular localization method upon its users.
86
86
But since GLib itself is localized using the <a
87
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#gettext"
87
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
88
88
><code class="function">gettext()</code></a> mechanism, it seems
89
89
natural to offer the de-facto standard <a
90
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#gettext"
90
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
91
91
><code class="function">gettext()</code></a> support macros in an
113
113
<pre class="programlisting">#define Q_(String)</pre>
116
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#gettext-macro"
116
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext-macro"
117
117
><code class="function">_()</code></a>, but handles context in message ids. This has the advantage that
118
118
the string can be adorned with a prefix to guarantee uniqueness and provide
119
119
context to the translator.
219
219
This is useful in situations where the translated strings can't
220
220
be directly used, e.g. in string array initializers.
221
221
To get the translated string, call <a
222
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#gettext"
222
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
223
223
><code class="function">gettext()</code></a> at runtime.
225
225
<div class="informalexample"><pre class="programlisting">
311
311
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid);</pre>
313
313
This function is a wrapper of <a
314
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#dgettext"
314
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
315
315
><code class="function">dgettext()</code></a> which does not translate
316
316
the message if the default domain as set with <a
317
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
317
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
318
318
><code class="function">textdomain()</code></a> has no
319
319
translations for the current locale.
322
322
The advantage of using this function over <a
323
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#dgettext"
323
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
324
324
><code class="function">dgettext()</code></a> proper is that
325
325
libraries using this function (like GTK+) will not use translations
326
326
if the application using the library does not have translations for
327
327
the current locale. This results in a consistent English-only
328
328
interface instead of one having partial translations. For this
329
329
feature to work, the call to <a
330
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
330
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
331
331
><code class="function">textdomain()</code></a> and <a class="link" href="glib-running.html#setlocale" title="Locale"><code class="function">setlocale()</code></a> should
332
332
precede any <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()"><code class="function">g_dgettext()</code></a> invocations. For GTK+, it means calling
334
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
334
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
335
335
><code class="function">textdomain()</code></a> before gtk_init or its variants.
347
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
347
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
348
348
><code class="function">textdomain()</code></a> has been called to set a default text domain</li>
349
349
<li>there is no translations available for the default text domain
350
350
and the current locale</li>
357
357
Note that this behavior may not be desired for example if an application
358
358
has its untranslated messages in a language other than English. In those
359
359
cases the application should call <a
360
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
360
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
361
361
><code class="function">textdomain()</code></a> after initializing GTK+.
364
364
Applications should normally not use this function directly,
366
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#gettext-macro"
366
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext-macro"
367
367
><code class="function">_()</code></a> macro for translations.</p>
375
375
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
376
376
<td> the translation domain to use, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to use
377
377
the domain set with <a
378
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
378
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
379
379
><code class="function">textdomain()</code></a>
406
406
This function is a wrapper of <code class="function">dngettext()</code> which does not translate
407
407
the message if the default domain as set with <a
408
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
408
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
409
409
><code class="function">textdomain()</code></a> has no
410
410
translations for the current locale.
422
422
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
423
423
<td> the translation domain to use, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to use
424
424
the domain set with <a
425
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
425
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
426
426
><code class="function">textdomain()</code></a>
471
471
This uses <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()"><code class="function">g_dgettext()</code></a> internally. See that functions for differences
473
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#dgettext"
473
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
474
474
><code class="function">dgettext()</code></a> proper.
486
486
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
487
487
<td> the translation domain to use, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to use
488
488
the domain set with <a
489
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
489
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
490
490
><code class="function">textdomain()</code></a>
528
528
This uses <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()"><code class="function">g_dgettext()</code></a> internally. See that functions for differences
530
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#dgettext"
530
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
531
531
><code class="function">dgettext()</code></a> proper.
543
543
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
544
544
<td> the translation domain to use, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to use
545
545
the domain set with <a
546
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#textdomain"
546
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
547
547
><code class="function">textdomain()</code></a>
575
575
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgval);</pre>
577
577
An auxiliary function for <a
578
href="/usr/share/gtk-doc/html/libnautilus-extension/libnautilus-extension-nautilus-extension-i18n.html#gettext"
578
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
579
579
><code class="function">gettext()</code></a> support (see <a class="link" href="glib-I18N.html#Q-:CAPS" title="Q_()"><code class="function">Q_()</code></a>).</p>