📄 glib-i18n.html
字号:
<td>the translated message</td></tr></tbody></table></div><p class="since">Since 2.16</p></div><hr><div class="refsect2" lang="en"><a name="id3031585"></a><h3><a name="N-:CAPS"></a>N_()</h3><a class="indexterm" name="id3031600"></a><pre class="programlisting">#define N_(String)</pre><p>Only marks a string for translation.This is useful in situations where the translated strings can'tbe directly used, e.g. in string array initializers. To get the translated string, call <code class="function">gettext()</code> at runtime.</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 > 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><p><span class="term"><em class="parameter"><code>String</code></em> :</span></p></td><td>the string to be translated</td></tr></tbody></table></div><p class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3031671"></a><h3><a name="g-strip-context"></a>g_strip_context ()</h3><a class="indexterm" name="id3031686"></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, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgval);</pre><p>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><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>msgid</code></em> :</span></p></td><td> a string</td></tr><tr><td><p><span class="term"><em class="parameter"><code>msgval</code></em> :</span></p></td><td> another string</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></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 class="since">Since 2.4</p></div><hr><div class="refsect2" lang="en"><a name="id3031817"></a><h3><a name="g-dpgettext"></a>g_dpgettext ()</h3><a class="indexterm" name="id3031831"></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, const <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *msgctxtid, <a class="link" href="glib-Basic-Types.html#gsize">gsize</a> msgidoffset);</pre><p>This function is a variant of <code class="function">dgettext()</code> which supportsa disambiguating message context. GNU gettext uses the'\004' character to separate the message context andmessage id in <em class="parameter"><code>msgctxtid</code></em>.If 0 is passed as <em class="parameter"><code>msgidoffset</code></em>, this function will fall back totrying to use the deprecated convention of using "|" as a separationcharacter.</p><p>Applications should normally not use this function directly,but use the <a class="link" href="glib-I18N.html#C-:CAPS"><code class="function">C_()</code></a> macro for translations with context.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>domain</code></em> :</span></p></td><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 the domain set with <code class="function">textdomain()</code></td></tr><tr><td><p><span class="term"><em class="parameter"><code>msgctxtid</code></em> :</span></p></td><td> a combined message context and message id, separated by a \004 character</td></tr><tr><td><p><span class="term"><em class="parameter"><code>msgidoffset</code></em> :</span></p></td><td> the offset of the message id in <em class="parameter"><code>msgctxid</code></em></td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> The translated string</td></tr></tbody></table></div><p class="since">Since 2.16</p></div><hr><div class="refsect2" lang="en"><a name="id3032017"></a><h3><a name="g-get-language-names"></a>g_get_language_names ()</h3><a class="indexterm" name="id3032032"></a><pre class="programlisting">const <a class="link" 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><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><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 that must not be modified or freed.</td></tr></tbody></table></div><p class="since">Since 2.6</p></div></div><div class="refsect1" lang="en"><a name="id3032120"></a><h2>See Also</h2><p>The gettext manual.</p></div><div class="refsect1" lang="en"><a name="id3032131"></a><div class="refsect2" lang="en"><a name="id3032132"></a></div><hr><div class="refsect2" lang="en"><a name="id3032133"></a></div></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -