~ubuntu-branches/ubuntu/intrepid/glib2.0/intrepid-updates

« back to all changes in this revision

Viewing changes to docs/reference/glib/html/glib-I18N.html

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-09-19 13:04:41 UTC
  • mfrom: (1.2.48 upstream)
  • Revision ID: james.westby@ubuntu.com-20080919130441-p3x1zuo6ysjku2wq
Tags: 2.18.1-0ubuntu1
* New upstream version:
  - Bugs fixed:
  550433 g_test_init doesn't recognize --help
  523463 Core dump in gmain.c:2482:IA__g_main_context_check
  551228 G_STRFUNC on recent Sun compiler should be expanded...
  551410 gtestutils.c: using printf without prototype
  551731 g_date_set_time[_t] docs should mention what timezone
  548321 <string.h> is not included in gi18n-lib.h
  551149 xdgmime mem leak
  550647 synchronous pipe I/O when reading mount reply
  551887 Docs for g_desktop_app_info_new_from_filename aren't...
  551681 g_content_type_guess() too naive with filenames
  552352 g_app_info_launch doesn't work if "Path" key...
  551408 gmodule.def generated to builddir...
  552359 g_file_info_get_icon should return GThemedIcon, and...

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
<p>
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 
92
92
easy-to-use form.
93
93
</p>
113
113
<pre class="programlisting">#define             Q_(String)</pre>
114
114
<p>
115
115
Like <a
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.
224
224
</p>
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>
312
312
<p>
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.
320
320
</p>
321
321
<p>
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
333
333
<a
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.
336
336
</p>
337
337
<p>
344
344
</li>
345
345
<li>
346
346
<a
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+.
362
362
</p>
363
363
<p>
364
364
Applications should normally not use this function directly,
365
365
but use the <a
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>
368
368
<p>
369
369
 
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>
380
380
</td>
381
381
</tr>
405
405
<p>
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.
411
411
</p>
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>
427
427
</td>
428
428
</tr>
470
470
<p>
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
472
472
with <a
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.
475
475
</p>
476
476
<p>
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>
491
491
</td>
492
492
</tr>
527
527
<p>
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
529
529
with <a
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.
532
532
</p>
533
533
<p>
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>
548
548
</td>
549
549
</tr>
575
575
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgval);</pre>
576
576
<p>
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>
580
580
<p>
581
581