KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /usr/share/gtk-doc/html/glib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/gtk-doc/html/glib/glib-I18N.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Internationalization</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-utilities.html" title="GLib Utilities">
<link rel="prev" href="glib-Base64-Encoding.html" title="Base64 Encoding">
<link rel="next" href="glib-Date-and-Time-Functions.html" title="Date and Time Functions">
<meta name="generator" content="GTK-Doc V1.6 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Base64-Encoding.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-utilities.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<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>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id3039032" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id3039117" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-I18N"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id3039032"></a><span class="refentrytitle">Internationalization</span>
</h2>
<p>Internationalization &#8212; gettext support macros.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;
#include &lt;glib/gi18n.h&gt;


#define     <a href="glib-I18N.html#gettext-macro">_</a>                               (String)
#define     <a href="glib-I18N.html#Q-:CAPS">Q_</a>                              (String)
#define     <a href="glib-I18N.html#N-:CAPS">N_</a>                              (String)
const <a href="glib-Basic-Types.html#gchar">gchar</a>* <a href="glib-I18N.html#g-strip-context">g_strip_context</a>                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *msgid,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *msgval);

const <a href="glib-Basic-Types.html#gchar">gchar</a>* const * <a href="glib-I18N.html#g-get-language-names">g_get_language_names</a>   (void);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id3039117"></a><h2>Description</h2>
<p>
GLib doesn't force any particular localization method upon its users.
But since GLib itself is localized using the <a
href="../libbonobo/libbonobo-bonobo-i18n.html#gettext"
><code class="function">gettext()</code></a> mechanism, it seems
natural to offer the de-facto standard <a
href="../libbonobo/libbonobo-bonobo-i18n.html#gettext"
><code class="function">gettext()</code></a> support macros in an 
easy-to-use form.
</p>
<p>
In order to use these macros in an application, you must include 
<code class="filename">glib/gi18n.h</code>. For use in a library, must include
<code class="filename">glib/gi18n-lib.h</code> <span class="emphasis"><em>after</em></span> defining
the GETTEXT_PACKAGE macro suitably for your library:
</p>
<div class="informalexample"><pre class="programlisting">
#define GETTEXT_PACKAGE "gtk20"
#include &lt;glib/gi18n-lib.h&gt;
</pre></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id3039187"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id3039197"></a><h3>
<a name="gettext-macro"></a>_()</h3>
<a class="indexterm" name="id3039212"></a><pre class="programlisting">#define     _(String)</pre>
<p>
Marks a string for translation, gets replaced with the translated string
at runtime.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>String</code></em>&#160;:</span></td>
<td>the string to be translated
</td>
</tr></tbody>
</table></div>
<p>Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3039251"></a><h3>
<a name="Q-:CAPS"></a>Q_()</h3>
<a class="indexterm" name="id3039266"></a><pre class="programlisting">#define     Q_(String)</pre>
<p>
Like <a href="glib-I18N.html#gettext-macro"><code class="function">_()</code></a>, but applies <a href="glib-I18N.html#g-strip-context"><code class="function">g_strip_context()</code></a> to the translation. This has the
advantage that the string can be adorned with a prefix to guarantee 
uniqueness and provide context to the translator.
</p>
<p>
One use case given in the gettext manual is GUI translation, where one could 
e.g. disambiguate two "Open" menu entries as "File|Open" and "Printer|Open". 
Another use case is the string "Russian" which may have to be translated
differently depending on whether it's the name of a character set or a 
language. This could be solved by using "charset|Russian" and 
"language|Russian".
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>String</code></em>&#160;:</span></td>
<td>the string to be translated, with a '|'-separated prefix which 
  must not be translated
</td>
</tr></tbody>
</table></div>
<p>Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3039339"></a><h3>
<a name="N-:CAPS"></a>N_()</h3>
<a class="indexterm" name="id3039353"></a><pre class="programlisting">#define     N_(String)</pre>
<p>
Marks a string for translation, gets replaced with the untranslated string
at runtime. This is useful in situations where the translated strings can't
be directly used, e.g. in string array initializers. 
</p>
<div class="informalexample"><pre class="programlisting">
     {
       static const char *messages[] = {
         N_("some very meaningful message"),
         N_("and another one")
       };
       const char *string;
       ...
       string
         = index &gt; 1 ? _("a default message") : gettext (messages[index]);
     
       fputs (string);
       ...
     }
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><em class="parameter"><code>String</code></em>&#160;:</span></td>
<td>the string to be translated
</td>
</tr></tbody>
</table></div>
<p>Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3039412"></a><h3>
<a name="g-strip-context"></a>g_strip_context ()</h3>
<a class="indexterm" name="id3039427"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* g_strip_context                (const <a href="glib-Basic-Types.html#gchar">gchar</a> *msgid,
                                             const <a href="glib-Basic-Types.html#gchar">gchar</a> *msgval);</pre>
<p>
An auxiliary function for <a
href="../libbonobo/libbonobo-bonobo-i18n.html#gettext"
><code class="function">gettext()</code></a> support (see <a href="glib-I18N.html#Q-:CAPS"><code class="function">Q_()</code></a>).</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>msgid</code></em>&#160;:</span></td>
<td> a string
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>msgval</code></em>&#160;:</span></td>
<td> another string
</td>
</tr>
<tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<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
  a '|' character, in which case a pointer to the substring of msgid after
  the first '|' character is returned. 

</td>
</tr>
</tbody>
</table></div>
<p>Since  2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id3039555"></a><h3>
<a name="g-get-language-names"></a>g_get_language_names ()</h3>
<a class="indexterm" name="id3039571"></a><pre class="programlisting">const <a href="glib-Basic-Types.html#gchar">gchar</a>* const * g_get_language_names   (void);</pre>
<p>
Computes a list of applicable locale names, which can be used to 
e.g. construct locale-dependent filenames or search paths. The returned 
list is sorted from most desirable to least desirable and always contains 
the default locale "C".
</p>
<p>
For example, if LANGUAGE=de:en_US, then the returned list is
"de", "en_US", "en", "C".
</p>
<p>
This function consults the environment variables <code class="envar">LANGUAGE</code>, 
<code class="envar">LC_ALL</code>, <code class="envar">LC_MESSAGES</code> and <code class="envar">LANG</code> 
to find the list of locales specified by the user.</p>
<p>

</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td>
<span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> a <a href="glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated array of strings owned by GLib 
   that must not be modified or freed.

</td>
</tr></tbody>
</table></div>
<p>Since  2.6
</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id3039656"></a><h2>See Also</h2>
<p>
The gettext manual.
</p>
</div>
</div>
</body>
</html>

Anon7 - 2021