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