~ubuntu-branches/debian/squeeze/glib2.0/squeeze

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-02-15 13:00:43 UTC
  • mfrom: (1.3.1 upstream) (69.1.10 intrepid)
  • Revision ID: james.westby@ubuntu.com-20090215130043-q47fbt3owmt42m2f
Tags: 2.18.4-2
* Release to unstable
* debian/rules:
- bump SHVER, since we are already forcing a 2.18.0 dependecy on the
  symbols introduced in the development versions
* debian/control.in:
- added Homepage and Vcs-* control fields

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
2
<html>
3
3
<head>
4
 
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
 
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>Internationalization</title>
6
 
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
7
 
<link rel="start" href="index.html" title="GLib Reference Manual">
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
 
7
<link rel="home" href="index.html" title="GLib Reference Manual">
8
8
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
9
9
<link rel="prev" href="glib-Data-Checksums.html" title="Data Checksums">
10
10
<link rel="next" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions">
11
 
<meta name="generator" content="GTK-Doc V1.9 (XML mode)">
 
11
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
12
12
<link rel="stylesheet" href="style.css" type="text/css">
13
13
<link rel="chapter" href="glib.html" title="GLib Overview">
14
14
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
26
26
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
27
27
<link rel="index" href="ix09.html" title="Index of new symbols in 2.14">
28
28
<link rel="index" href="ix10.html" title="Index of new symbols in 2.16">
 
29
<link rel="index" href="ix11.html" title="Index of new symbols in 2.18">
29
30
</head>
30
31
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
31
32
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
36
37
<th width="100%" align="center">GLib Reference Manual</th>
37
38
<td><a accesskey="n" href="glib-Date-and-Time-Functions.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
38
39
</tr>
39
 
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3088091" class="shortcut">Top</a>
40
 
                  &#160;|&#160;
41
 
                  <a href="#id3088217" class="shortcut">Description</a></nobr></td></tr>
 
40
<tr><td colspan="5" class="shortcuts">
 
41
<a href="#glib-I18N.synopsis" class="shortcut">Top</a>
 
42
                 | 
 
43
                <a href="#glib-I18N.description" class="shortcut">Description</a>
 
44
</td></tr>
42
45
</table>
43
46
<div class="refentry" lang="en">
44
47
<a name="glib-I18N"></a><div class="titlepage"></div>
45
48
<div class="refnamediv"><table width="100%"><tr>
46
49
<td valign="top">
47
 
<h2>
48
 
<a name="id3088091"></a><span class="refentrytitle">Internationalization</span>
49
 
</h2>
50
 
<p>Internationalization &#8212; gettext support macros</p>
 
50
<h2><span class="refentrytitle"><a name="glib-I18N.top_of_page"></a>Internationalization</span></h2>
 
51
<p>Internationalization — gettext support macros</p>
51
52
</td>
52
53
<td valign="top" align="right"></td>
53
54
</tr></table></div>
54
55
<div class="refsynopsisdiv">
55
 
<h2>Synopsis</h2>
 
56
<a name="glib-I18N.synopsis"></a><h2>Synopsis</h2>
56
57
<pre class="synopsis">
57
58
 
58
59
#include &lt;glib.h&gt;
59
60
#include &lt;glib/gi18n.h&gt;
60
61
 
61
 
 
62
 
#define             <a class="link" href="glib-I18N.html#Q-:CAPS">Q_</a>                                  (String)
63
 
#define             <a class="link" href="glib-I18N.html#C-:CAPS">C_</a>                                  (Context,String)
64
 
#define             <a class="link" href="glib-I18N.html#N-:CAPS">N_</a>                                  (String)
65
 
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        <a class="link" href="glib-I18N.html#g-strip-context">g_strip_context</a>                     (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgid,
66
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgval);
67
 
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        <a class="link" href="glib-I18N.html#g-dpgettext">g_dpgettext</a>                         (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *domain,
68
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgctxtid,
69
 
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> msgidoffset);
70
 
 
71
 
const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* const * <a class="link" href="glib-I18N.html#g-get-language-names">g_get_language_names</a>               (void);
 
62
#define             <a class="link" href="glib-I18N.html#Q---CAPS" title="Q_()">Q_</a>                                  (String)
 
63
#define             <a class="link" href="glib-I18N.html#C---CAPS" title="C_()">C_</a>                                  (Context,String)
 
64
#define             <a class="link" href="glib-I18N.html#N---CAPS" title="N_()">N_</a>                                  (String)
 
65
#define             <a class="link" href="glib-I18N.html#NC---CAPS" title="NC_()">NC_</a>                                 (Context, String)
 
66
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()">g_dgettext</a>                          (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
67
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid);
 
68
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       <a class="link" href="glib-I18N.html#g-dngettext" title="g_dngettext ()">g_dngettext</a>                         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
69
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid,
 
70
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid_plural,
 
71
                                                         <a class="link" href="glib-Basic-Types.html#gulong" title="gulong">gulong</a> n);
 
72
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       <a class="link" href="glib-I18N.html#g-dpgettext" title="g_dpgettext ()">g_dpgettext</a>                         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
73
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgctxtid,
 
74
                                                         <a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> msgidoffset);
 
75
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       <a class="link" href="glib-I18N.html#g-dpgettext2" title="g_dpgettext2 ()">g_dpgettext2</a>                        (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
76
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *context,
 
77
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid);
 
78
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       <a class="link" href="glib-I18N.html#g-strip-context" title="g_strip_context ()">g_strip_context</a>                     (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid,
 
79
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgval);
 
80
 
 
81
const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a>* const * <a class="link" href="glib-I18N.html#g-get-language-names" title="g_get_language_names ()">g_get_language_names</a>               (void);
72
82
</pre>
73
83
</div>
74
84
<div class="refsect1" lang="en">
75
 
<a name="id3088217"></a><h2>Description</h2>
 
85
<a name="glib-I18N.description"></a><h2>Description</h2>
76
86
<p>
77
87
GLib doesn't force any particular localization method upon its users.
78
 
But since GLib itself is localized using the <code class="function">gettext()</code> mechanism, it seems
79
 
natural to offer the de-facto standard <code class="function">gettext()</code> support macros in an 
 
88
But since GLib itself is localized using the <a
 
89
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
 
90
><code class="function">gettext()</code></a> mechanism, it seems
 
91
natural to offer the de-facto standard <a
 
92
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
 
93
><code class="function">gettext()</code></a> support macros in an
80
94
easy-to-use form.
81
95
</p>
82
96
<p>
83
 
In order to use these macros in an application, you must include 
 
97
In order to use these macros in an application, you must include
84
98
<code class="filename">glib/gi18n.h</code>. For use in a library, must include
85
99
<code class="filename">glib/gi18n-lib.h</code> <span class="emphasis"><em>after</em></span> defining
86
100
the GETTEXT_PACKAGE macro suitably for your library:
95
109
</p>
96
110
</div>
97
111
<div class="refsect1" lang="en">
98
 
<a name="id3088289"></a><h2>Details</h2>
 
112
<a name="glib-I18N.details"></a><h2>Details</h2>
99
113
<div class="refsect2" lang="en">
100
 
<a name="id3088299"></a><h3>
101
 
<a name="Q-:CAPS"></a>Q_()</h3>
102
 
<a class="indexterm" name="id3088314"></a><pre class="programlisting">#define             Q_(String)</pre>
 
114
<a name="Q---CAPS"></a><h3>Q_()</h3>
 
115
<pre class="programlisting">#define             Q_(String)</pre>
103
116
<p>
104
 
Like <code class="function">_()</code>, but handles context in message ids. This has the advantage that 
105
 
the string can be adorned with a prefix to guarantee uniqueness and provide 
106
 
context to the translator. 
 
117
Like <a
 
118
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext-macro"
 
119
><code class="function">_()</code></a>, but handles context in message ids. This has the advantage that
 
120
the string can be adorned with a prefix to guarantee uniqueness and provide
 
121
context to the translator.
107
122
</p>
108
123
<p>
109
 
One use case given in the gettext manual is GUI translation, where one could 
110
 
e.g. disambiguate two "Open" menu entries as "File|Open" and "Printer|Open". 
 
124
One use case given in the gettext manual is GUI translation, where one could
 
125
e.g. disambiguate two "Open" menu entries as "File|Open" and "Printer|Open".
111
126
Another use case is the string "Russian" which may have to be translated
112
 
differently depending on whether it's the name of a character set or a 
113
 
language. This could be solved by using "charset|Russian" and 
 
127
differently depending on whether it's the name of a character set or a
 
128
language. This could be solved by using "charset|Russian" and
114
129
"language|Russian".
115
130
</p>
116
131
<p>
117
 
See the <a class="link" href="glib-I18N.html#C-:CAPS"><code class="function">C_()</code></a> macro for a different way to mark up translatable strings
 
132
See the <a class="link" href="glib-I18N.html#C---CAPS" title="C_()"><code class="function">C_()</code></a> macro for a different way to mark up translatable strings
118
133
with context.
119
134
</p>
120
135
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
121
136
<h3 class="title">Note</h3>
122
137
<p>
123
 
If you are using the <a class="link" href="glib-I18N.html#Q-:CAPS"><code class="function">Q_()</code></a> macro, you need to make sure that you 
 
138
If you are using the <a class="link" href="glib-I18N.html#Q---CAPS" title="Q_()"><code class="function">Q_()</code></a> macro, you need to make sure that you
124
139
pass <code class="option">--keyword=Q_</code> to xgettext when extracting messages.
125
140
If you are using GNU gettext &gt;= 0.15, you can also use
126
141
<code class="option">--keyword=Q_:1g</code> to let xgettext split the context
131
146
<col align="left" valign="top">
132
147
<tbody>
133
148
<tr>
134
 
<td><p><span class="term"><em class="parameter"><code>String</code></em>&#160;:</span></p></td>
 
149
<td><p><span class="term"><em class="parameter"><code>String</code></em> :</span></p></td>
135
150
<td>the string to be translated, with a '|'-separated prefix which 
136
151
  must not be translated
137
152
</td>
138
153
</tr>
139
154
<tr>
140
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
155
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
141
156
<td>the translated message
142
157
</td>
143
158
</tr>
144
159
</tbody>
145
160
</table></div>
146
 
<p class="since">Since 2.4
147
 
 
148
 
 
149
 
</p>
 
161
<p class="since">Since 2.4</p>
150
162
</div>
151
163
<hr>
152
164
<div class="refsect2" lang="en">
153
 
<a name="id3088432"></a><h3>
154
 
<a name="C-:CAPS"></a>C_()</h3>
155
 
<a class="indexterm" name="id3088446"></a><pre class="programlisting">#define             C_(Context,String)</pre>
 
165
<a name="C---CAPS"></a><h3>C_()</h3>
 
166
<pre class="programlisting">#define             C_(Context,String)</pre>
156
167
<p>
157
 
Uses gettext to get the translation for <em class="parameter"><code>msgid</code></em>. <em class="parameter"><code>msgctxt</code></em> is 
158
 
used as a context. This is mainly useful for short strings which 
159
 
may need different translations, depending on the context in which 
 
168
Uses gettext to get the translation for <em class="parameter"><code>msgid</code></em>. <em class="parameter"><code>msgctxt</code></em> is
 
169
used as a context. This is mainly useful for short strings which
 
170
may need different translations, depending on the context in which
160
171
they are used.
161
172
</p>
162
173
<div class="informalexample"><pre class="programlisting">
163
174
label1 = C_("Navigation", "Back");
164
175
label2 = C_("Body part", "Back");
165
176
</pre></div>
166
 
<p> 
 
177
<p>
167
178
</p>
168
179
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
169
180
<h3 class="title">Note</h3>
170
181
<p>
171
 
If you are using the <a class="link" href="glib-I18N.html#C-:CAPS"><code class="function">C_()</code></a> macro, you need to make sure that you 
172
 
pass <code class="option">--keyword=C_:1c,2</code> to xgettext when extracting 
173
 
messages. Note that this only works with GNU gettext &gt;= 0.15. 
 
182
If you are using the <a class="link" href="glib-I18N.html#C---CAPS" title="C_()"><code class="function">C_()</code></a> macro, you need to make sure that you
 
183
pass <code class="option">--keyword=C_:1c,2</code> to xgettext when extracting
 
184
messages. Note that this only works with GNU gettext &gt;= 0.15.
174
185
</p>
175
186
</div>
176
187
<div class="variablelist"><table border="0">
177
188
<col align="left" valign="top">
178
189
<tbody>
179
190
<tr>
180
 
<td><p><span class="term"><em class="parameter"><code>Context</code></em>&#160;:</span></p></td>
 
191
<td><p><span class="term"><em class="parameter"><code>Context</code></em> :</span></p></td>
181
192
<td>a message context, must be a string literal
182
193
</td>
183
194
</tr>
184
195
<tr>
185
 
<td><p><span class="term"><em class="parameter"><code>String</code></em>&#160;:</span></p></td>
 
196
<td><p><span class="term"><em class="parameter"><code>String</code></em> :</span></p></td>
186
197
<td>a message id, must be a string literal
187
198
</td>
188
199
</tr>
189
200
<tr>
190
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
 
201
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
191
202
<td>the translated message
192
203
</td>
193
204
</tr>
194
205
</tbody>
195
206
</table></div>
196
 
<p class="since">Since 2.16
197
 
 
198
 
 
199
 
</p>
 
207
<p class="since">Since 2.16</p>
200
208
</div>
201
209
<hr>
202
210
<div class="refsect2" lang="en">
203
 
<a name="id3088556"></a><h3>
204
 
<a name="N-:CAPS"></a>N_()</h3>
205
 
<a class="indexterm" name="id3088570"></a><pre class="programlisting">#define             N_(String)</pre>
 
211
<a name="N---CAPS"></a><h3>N_()</h3>
 
212
<pre class="programlisting">#define             N_(String)</pre>
206
213
<p>
207
214
Only marks a string for translation.
208
215
This is useful in situations where the translated strings can't
209
 
be directly used, e.g. in string array initializers. 
210
 
To get the translated string, call <code class="function">gettext()</code> at runtime.
 
216
be directly used, e.g. in string array initializers.
 
217
To get the translated string, call <a
 
218
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
 
219
><code class="function">gettext()</code></a> at runtime.
211
220
</p>
212
221
<div class="informalexample"><pre class="programlisting">
213
222
     {
219
228
       ...
220
229
       string
221
230
         = index &gt; 1 ? _("a default message") : gettext (messages[index]);
222
 
     
 
231
 
223
232
       fputs (string);
224
233
       ...
225
234
     }
227
236
<div class="variablelist"><table border="0">
228
237
<col align="left" valign="top">
229
238
<tbody><tr>
230
 
<td><p><span class="term"><em class="parameter"><code>String</code></em>&#160;:</span></p></td>
 
239
<td><p><span class="term"><em class="parameter"><code>String</code></em> :</span></p></td>
231
240
<td>the string to be translated
232
241
</td>
233
242
</tr></tbody>
234
243
</table></div>
235
 
<p class="since">Since 2.4
236
 
 
237
 
 
238
 
</p>
239
 
</div>
240
 
<hr>
241
 
<div class="refsect2" lang="en">
242
 
<a name="id3088641"></a><h3>
243
 
<a name="g-strip-context"></a>g_strip_context ()</h3>
244
 
<a class="indexterm" name="id3088657"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_strip_context                     (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgid,
245
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgval);</pre>
246
 
<p>
247
 
An auxiliary function for <code class="function">gettext()</code> support (see <a class="link" href="glib-I18N.html#Q-:CAPS"><code class="function">Q_()</code></a>).</p>
248
 
<p>
249
 
 
250
 
</p>
251
 
<div class="variablelist"><table border="0">
252
 
<col align="left" valign="top">
253
 
<tbody>
254
 
<tr>
255
 
<td><p><span class="term"><em class="parameter"><code>msgid</code></em>&#160;:</span></p></td>
256
 
<td> a string
257
 
</td>
258
 
</tr>
259
 
<tr>
260
 
<td><p><span class="term"><em class="parameter"><code>msgval</code></em>&#160;:</span></p></td>
261
 
<td> another string
262
 
</td>
263
 
</tr>
264
 
<tr>
265
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
266
 
<td> <em class="parameter"><code>msgval</code></em>, unless <em class="parameter"><code>msgval</code></em> is identical to <em class="parameter"><code>msgid</code></em> and contains
267
 
  a '|' character, in which case a pointer to the substring of msgid after
268
 
  the first '|' character is returned. 
269
 
 
270
 
</td>
271
 
</tr>
272
 
</tbody>
273
 
</table></div>
274
 
<p class="since">Since  2.4
275
 
</p>
276
 
</div>
277
 
<hr>
278
 
<div class="refsect2" lang="en">
279
 
<a name="id3088787"></a><h3>
280
 
<a name="g-dpgettext"></a>g_dpgettext ()</h3>
281
 
<a class="indexterm" name="id3088802"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>*        g_dpgettext                         (const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *domain,
282
 
                                                         const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgctxtid,
283
 
                                                         <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> msgidoffset);</pre>
284
 
<p>
285
 
This function is a variant of <code class="function">dgettext()</code> which supports
 
244
<p class="since">Since 2.4</p>
 
245
</div>
 
246
<hr>
 
247
<div class="refsect2" lang="en">
 
248
<a name="NC---CAPS"></a><h3>NC_()</h3>
 
249
<pre class="programlisting">#define             NC_(Context, String)</pre>
 
250
<p>
 
251
Only marks a string for translation, with context.
 
252
This is useful in situations where the translated strings can't
 
253
be directly used, e.g. in string array initializers.
 
254
To get the translated string, you should call <a class="link" href="glib-I18N.html#g-dpgettext2" title="g_dpgettext2 ()"><code class="function">g_dpgettext2()</code></a> at runtime.
 
255
</p>
 
256
<div class="informalexample"><pre class="programlisting">
 
257
     {
 
258
       static const char *messages[] = {
 
259
         NC_("some context", "some very meaningful message"),
 
260
         NC_("some context", "and another one")
 
261
       };
 
262
       const char *string;
 
263
       ...
 
264
       string
 
265
         = index &gt; 1 ? g_dpgettext2 (NULL, "some context", "a default message") : g_dpgettext2 (NULL, "some context", messages[index]);
 
266
 
 
267
       fputs (string);
 
268
       ...
 
269
     }
 
270
</pre></div>
 
271
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
 
272
<h3 class="title">Note</h3>
 
273
<p>
 
274
If you are using the <a class="link" href="glib-I18N.html#NC---CAPS" title="NC_()"><code class="function">NC_()</code></a> macro, you need to make sure that you
 
275
pass <code class="option">--keyword=NC_:1c,2</code> to xgettext when extracting
 
276
messages. Note that this only works with GNU gettext &gt;= 0.15.
 
277
Intltool has support for the <a class="link" href="glib-I18N.html#NC---CAPS" title="NC_()"><code class="function">NC_()</code></a> macro since version 0.40.1.
 
278
</p>
 
279
</div>
 
280
<div class="variablelist"><table border="0">
 
281
<col align="left" valign="top">
 
282
<tbody>
 
283
<tr>
 
284
<td><p><span class="term"><em class="parameter"><code>Context</code></em> :</span></p></td>
 
285
<td>a message context, must be a string literal
 
286
</td>
 
287
</tr>
 
288
<tr>
 
289
<td><p><span class="term"><em class="parameter"><code>String</code></em> :</span></p></td>
 
290
<td>a message id, must be a string literal
 
291
</td>
 
292
</tr>
 
293
</tbody>
 
294
</table></div>
 
295
<p class="since">Since 2.18</p>
 
296
</div>
 
297
<hr>
 
298
<div class="refsect2" lang="en">
 
299
<a name="g-dgettext"></a><h3>g_dgettext ()</h3>
 
300
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_dgettext                          (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
301
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid);</pre>
 
302
<p>
 
303
This function is a wrapper of <a
 
304
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
 
305
><code class="function">dgettext()</code></a> which does not translate
 
306
the message if the default domain as set with <a
 
307
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
308
><code class="function">textdomain()</code></a> has no
 
309
translations for the current locale.
 
310
</p>
 
311
<p>
 
312
The advantage of using this function over <a
 
313
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
 
314
><code class="function">dgettext()</code></a> proper is that
 
315
libraries using this function (like GTK+) will not use translations
 
316
if the application using the library does not have translations for
 
317
the current locale.  This results in a consistent English-only
 
318
interface instead of one having partial translations.  For this
 
319
feature to work, the call to <a
 
320
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
321
><code class="function">textdomain()</code></a> and <a class="link" href="glib-running.html#setlocale" title="Locale"><code class="function">setlocale()</code></a> should
 
322
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
 
323
<a
 
324
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
325
><code class="function">textdomain()</code></a> before gtk_init or its variants.
 
326
</p>
 
327
<p>
 
328
This function disables translations if and only if upon its first
 
329
call all the following conditions hold:
 
330
</p>
 
331
<div class="itemizedlist"><ul type="disc">
 
332
<li>
 
333
<em class="parameter"><code>domain</code></em> is not <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>
 
334
</li>
 
335
<li>
 
336
<a
 
337
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
338
><code class="function">textdomain()</code></a> has been called to set a default text domain</li>
 
339
<li>there is no translations available for the default text domain
 
340
          and the current locale</li>
 
341
<li>current locale is not "C" or any English locales (those
 
342
          starting with "en_")</li>
 
343
</ul></div>
 
344
<p>
 
345
</p>
 
346
<p>
 
347
Note that this behavior may not be desired for example if an application
 
348
has its untranslated messages in a language other than English.  In those
 
349
cases the application should call <a
 
350
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
351
><code class="function">textdomain()</code></a> after initializing GTK+.
 
352
</p>
 
353
<p>
 
354
Applications should normally not use this function directly,
 
355
but use the <a
 
356
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext-macro"
 
357
><code class="function">_()</code></a> macro for translations.</p>
 
358
<p>
 
359
</p>
 
360
<div class="variablelist"><table border="0">
 
361
<col align="left" valign="top">
 
362
<tbody>
 
363
<tr>
 
364
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
 
365
<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
 
366
  the domain set with <a
 
367
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
368
><code class="function">textdomain()</code></a>
 
369
</td>
 
370
</tr>
 
371
<tr>
 
372
<td><p><span class="term"><em class="parameter"><code>msgid</code></em> :</span></p></td>
 
373
<td> message to translate
 
374
</td>
 
375
</tr>
 
376
<tr>
 
377
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
378
<td> The translated string
 
379
 
 
380
</td>
 
381
</tr>
 
382
</tbody>
 
383
</table></div>
 
384
<p class="since">Since 2.18</p>
 
385
</div>
 
386
<hr>
 
387
<div class="refsect2" lang="en">
 
388
<a name="g-dngettext"></a><h3>g_dngettext ()</h3>
 
389
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_dngettext                         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
390
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid,
 
391
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid_plural,
 
392
                                                         <a class="link" href="glib-Basic-Types.html#gulong" title="gulong">gulong</a> n);</pre>
 
393
<p>
 
394
This function is a wrapper of <code class="function">dngettext()</code> which does not translate
 
395
the message if the default domain as set with <a
 
396
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
397
><code class="function">textdomain()</code></a> has no
 
398
translations for the current locale.
 
399
</p>
 
400
<p>
 
401
See <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()"><code class="function">g_dgettext()</code></a> for details of how this differs from <code class="function">dngettext()</code>
 
402
proper.</p>
 
403
<p>
 
404
</p>
 
405
<div class="variablelist"><table border="0">
 
406
<col align="left" valign="top">
 
407
<tbody>
 
408
<tr>
 
409
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
 
410
<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
 
411
  the domain set with <a
 
412
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
413
><code class="function">textdomain()</code></a>
 
414
</td>
 
415
</tr>
 
416
<tr>
 
417
<td><p><span class="term"><em class="parameter"><code>msgid</code></em> :</span></p></td>
 
418
<td> message to translate
 
419
</td>
 
420
</tr>
 
421
<tr>
 
422
<td><p><span class="term"><em class="parameter"><code>msgid_plural</code></em> :</span></p></td>
 
423
<td> plural form of the message
 
424
</td>
 
425
</tr>
 
426
<tr>
 
427
<td><p><span class="term"><em class="parameter"><code>n</code></em> :</span></p></td>
 
428
<td> the quantity for which translation is needed
 
429
</td>
 
430
</tr>
 
431
<tr>
 
432
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
433
<td> The translated string
 
434
 
 
435
</td>
 
436
</tr>
 
437
</tbody>
 
438
</table></div>
 
439
<p class="since">Since 2.18</p>
 
440
</div>
 
441
<hr>
 
442
<div class="refsect2" lang="en">
 
443
<a name="g-dpgettext"></a><h3>g_dpgettext ()</h3>
 
444
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_dpgettext                         (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
445
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgctxtid,
 
446
                                                         <a class="link" href="glib-Basic-Types.html#gsize" title="gsize">gsize</a> msgidoffset);</pre>
 
447
<p>
 
448
This function is a variant of <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()"><code class="function">g_dgettext()</code></a> which supports
286
449
a disambiguating message context. GNU gettext uses the
287
450
'\004' character to separate the message context and
288
451
message id in <em class="parameter"><code>msgctxtid</code></em>.
291
454
character.
292
455
</p>
293
456
<p>
 
457
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
 
458
with <a
 
459
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
 
460
><code class="function">dgettext()</code></a> proper.
 
461
</p>
 
462
<p>
294
463
Applications should normally not use this function directly,
295
 
but use the <a class="link" href="glib-I18N.html#C-:CAPS"><code class="function">C_()</code></a> macro for translations with context.</p>
 
464
but use the <a class="link" href="glib-I18N.html#C---CAPS" title="C_()"><code class="function">C_()</code></a> macro for translations with context.</p>
296
465
<p>
297
 
 
298
466
</p>
299
467
<div class="variablelist"><table border="0">
300
468
<col align="left" valign="top">
301
469
<tbody>
302
470
<tr>
303
 
<td><p><span class="term"><em class="parameter"><code>domain</code></em>&#160;:</span></p></td>
304
 
<td> the translation domain to use, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to use
305
 
  the domain set with <code class="function">textdomain()</code>
 
471
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
 
472
<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
 
473
  the domain set with <a
 
474
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
475
><code class="function">textdomain()</code></a>
306
476
</td>
307
477
</tr>
308
478
<tr>
309
 
<td><p><span class="term"><em class="parameter"><code>msgctxtid</code></em>&#160;:</span></p></td>
 
479
<td><p><span class="term"><em class="parameter"><code>msgctxtid</code></em> :</span></p></td>
310
480
<td> a combined message context and message id, separated
311
481
  by a \004 character
312
482
</td>
313
483
</tr>
314
484
<tr>
315
 
<td><p><span class="term"><em class="parameter"><code>msgidoffset</code></em>&#160;:</span></p></td>
 
485
<td><p><span class="term"><em class="parameter"><code>msgidoffset</code></em> :</span></p></td>
316
486
<td> the offset of the message id in <em class="parameter"><code>msgctxid</code></em>
317
487
</td>
318
488
</tr>
319
489
<tr>
320
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
321
 
<td> The translated string
322
 
 
323
 
</td>
324
 
</tr>
325
 
</tbody>
326
 
</table></div>
327
 
<p class="since">Since  2.16
328
 
</p>
329
 
</div>
330
 
<hr>
331
 
<div class="refsect2" lang="en">
332
 
<a name="id3088988"></a><h3>
333
 
<a name="g-get-language-names"></a>g_get_language_names ()</h3>
334
 
<a class="indexterm" name="id3089003"></a><pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a>* const * g_get_language_names               (void);</pre>
 
490
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
491
<td> The translated string
 
492
 
 
493
</td>
 
494
</tr>
 
495
</tbody>
 
496
</table></div>
 
497
<p class="since">Since 2.16</p>
 
498
</div>
 
499
<hr>
 
500
<div class="refsect2" lang="en">
 
501
<a name="g-dpgettext2"></a><h3>g_dpgettext2 ()</h3>
 
502
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_dpgettext2                        (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *domain,
 
503
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *context,
 
504
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid);</pre>
 
505
<p>
 
506
This function is a variant of <a class="link" href="glib-I18N.html#g-dgettext" title="g_dgettext ()"><code class="function">g_dgettext()</code></a> which supports
 
507
a disambiguating message context. GNU gettext uses the
 
508
'\004' character to separate the message context and
 
509
message id in <em class="parameter"><code>msgctxtid</code></em>.
 
510
</p>
 
511
<p>
 
512
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
 
513
with <a
 
514
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#dgettext"
 
515
><code class="function">dgettext()</code></a> proper.
 
516
</p>
 
517
<p>
 
518
This function differs from <a class="link" href="glib-I18N.html#C---CAPS" title="C_()"><code class="function">C_()</code></a> in that it is not a macro and 
 
519
thus you may use non-string-literals as context and msgid arguments.</p>
 
520
<p>
 
521
</p>
 
522
<div class="variablelist"><table border="0">
 
523
<col align="left" valign="top">
 
524
<tbody>
 
525
<tr>
 
526
<td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td>
 
527
<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
 
528
  the domain set with <a
 
529
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#textdomain"
 
530
><code class="function">textdomain()</code></a>
 
531
</td>
 
532
</tr>
 
533
<tr>
 
534
<td><p><span class="term"><em class="parameter"><code>context</code></em> :</span></p></td>
 
535
<td> the message context
 
536
</td>
 
537
</tr>
 
538
<tr>
 
539
<td><p><span class="term"><em class="parameter"><code>msgid</code></em> :</span></p></td>
 
540
<td> the message
 
541
</td>
 
542
</tr>
 
543
<tr>
 
544
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
545
<td> The translated string
 
546
 
 
547
</td>
 
548
</tr>
 
549
</tbody>
 
550
</table></div>
 
551
<p class="since">Since 2.18</p>
 
552
</div>
 
553
<hr>
 
554
<div class="refsect2" lang="en">
 
555
<a name="g-strip-context"></a><h3>g_strip_context ()</h3>
 
556
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *       g_strip_context                     (const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgid,
 
557
                                                         const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a> *msgval);</pre>
 
558
<p>
 
559
An auxiliary function for <a
 
560
href="/usr/share/gtk-doc/html/camel/camel-camel-i18n.html#gettext"
 
561
><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>
 
562
<p>
 
563
</p>
 
564
<div class="variablelist"><table border="0">
 
565
<col align="left" valign="top">
 
566
<tbody>
 
567
<tr>
 
568
<td><p><span class="term"><em class="parameter"><code>msgid</code></em> :</span></p></td>
 
569
<td> a string
 
570
</td>
 
571
</tr>
 
572
<tr>
 
573
<td><p><span class="term"><em class="parameter"><code>msgval</code></em> :</span></p></td>
 
574
<td> another string
 
575
</td>
 
576
</tr>
 
577
<tr>
 
578
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
579
<td> <em class="parameter"><code>msgval</code></em>, unless <em class="parameter"><code>msgval</code></em> is identical to <em class="parameter"><code>msgid</code></em> and contains
 
580
  a '|' character, in which case a pointer to the substring of msgid after
 
581
  the first '|' character is returned. 
 
582
 
 
583
</td>
 
584
</tr>
 
585
</tbody>
 
586
</table></div>
 
587
<p class="since">Since 2.4</p>
 
588
</div>
 
589
<hr>
 
590
<div class="refsect2" lang="en">
 
591
<a name="g-get-language-names"></a><h3>g_get_language_names ()</h3>
 
592
<pre class="programlisting">const <a class="link" href="glib-Basic-Types.html#gchar" title="gchar">gchar</a>* const * g_get_language_names               (void);</pre>
335
593
<p>
336
594
Computes a list of applicable locale names, which can be used to 
337
595
e.g. construct locale-dependent filenames or search paths. The returned 
347
605
<code class="envar">LC_ALL</code>, <code class="envar">LC_MESSAGES</code> and <code class="envar">LANG</code> 
348
606
to find the list of locales specified by the user.</p>
349
607
<p>
350
 
 
351
608
</p>
352
609
<div class="variablelist"><table border="0">
353
610
<col align="left" valign="top">
354
611
<tbody><tr>
355
 
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></p></td>
356
 
<td> a <a class="link" href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings owned by GLib 
 
612
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
 
613
<td> a <a class="link" href="glib-Standard-Macros.html#NULL--CAPS" title="NULL"><code class="literal">NULL</code></a>-terminated array of strings owned by GLib 
357
614
   that must not be modified or freed.
358
615
 
359
616
</td>
360
617
</tr></tbody>
361
618
</table></div>
362
 
<p class="since">Since  2.6
363
 
</p>
 
619
<p class="since">Since 2.6</p>
364
620
</div>
365
621
</div>
366
622
<div class="refsect1" lang="en">
367
 
<a name="id3089091"></a><h2>See Also</h2>
 
623
<a name="glib-I18N.see-also"></a><h2>See Also</h2>
368
624
<p>
369
625
The gettext manual.
370
626
</p>
371
627
</div>
372
 
<div class="refsect1" lang="en">
373
 
<a name="id3089101"></a><div class="refsect2" lang="en"><a name="id3089102"></a></div>
 
628
</div>
 
629
<div class="footer">
374
630
<hr>
375
 
<div class="refsect2" lang="en"><a name="id3089103"></a></div>
376
 
</div>
377
 
</div>
 
631
          Generated by GTK-Doc V1.11</div>
378
632
</body>
379
633
</html>