annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/doc/gettext/gettext.3.html @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 <!-- Creator : groff version 1.22.3 -->
jpayne@68 2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
jpayne@68 3 "http://www.w3.org/TR/html4/loose.dtd">
jpayne@68 4 <html>
jpayne@68 5 <head>
jpayne@68 6 <meta name="generator" content="groff -Thtml, see www.gnu.org">
jpayne@68 7 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
jpayne@68 8 <meta name="Content-Style" content="text/css">
jpayne@68 9 <style type="text/css">
jpayne@68 10 p { margin-top: 0; margin-bottom: 0; vertical-align: top }
jpayne@68 11 pre { margin-top: 0; margin-bottom: 0; vertical-align: top }
jpayne@68 12 table { margin-top: 0; margin-bottom: 0; vertical-align: top }
jpayne@68 13 h1 { text-align: center }
jpayne@68 14 </style>
jpayne@68 15 <title>GETTEXT</title>
jpayne@68 16
jpayne@68 17 </head>
jpayne@68 18 <body>
jpayne@68 19
jpayne@68 20 <h1 align="center">GETTEXT</h1>
jpayne@68 21
jpayne@68 22 <a href="#NAME">NAME</a><br>
jpayne@68 23 <a href="#SYNOPSIS">SYNOPSIS</a><br>
jpayne@68 24 <a href="#DESCRIPTION">DESCRIPTION</a><br>
jpayne@68 25 <a href="#RETURN VALUE">RETURN VALUE</a><br>
jpayne@68 26 <a href="#ERRORS">ERRORS</a><br>
jpayne@68 27 <a href="#BUGS">BUGS</a><br>
jpayne@68 28 <a href="#SEE ALSO">SEE ALSO</a><br>
jpayne@68 29
jpayne@68 30 <hr>
jpayne@68 31
jpayne@68 32
jpayne@68 33 <h2>NAME
jpayne@68 34 <a name="NAME"></a>
jpayne@68 35 </h2>
jpayne@68 36
jpayne@68 37
jpayne@68 38 <p style="margin-left:11%; margin-top: 1em">gettext,
jpayne@68 39 dgettext, dcgettext - translate message</p>
jpayne@68 40
jpayne@68 41 <h2>SYNOPSIS
jpayne@68 42 <a name="SYNOPSIS"></a>
jpayne@68 43 </h2>
jpayne@68 44
jpayne@68 45
jpayne@68 46 <p style="margin-left:11%; margin-top: 1em"><b>#include
jpayne@68 47 &lt;libintl.h&gt;</b></p>
jpayne@68 48
jpayne@68 49 <p style="margin-left:11%; margin-top: 1em"><b>char *
jpayne@68 50 gettext (const char *</b> <i>msgid</i><b>); <br>
jpayne@68 51 char * dgettext (const char *</b> <i>domainname</i><b>,
jpayne@68 52 const char *</b> <i>msgid</i><b>); <br>
jpayne@68 53 char * dcgettext (const char *</b> <i>domainname</i><b>,
jpayne@68 54 const char *</b> <i>msgid</i><b>, <br>
jpayne@68 55 int</b> <i>category</i><b>);</b></p>
jpayne@68 56
jpayne@68 57 <h2>DESCRIPTION
jpayne@68 58 <a name="DESCRIPTION"></a>
jpayne@68 59 </h2>
jpayne@68 60
jpayne@68 61
jpayne@68 62 <p style="margin-left:11%; margin-top: 1em">The
jpayne@68 63 <b>gettext</b>, <b>dgettext</b> and <b>dcgettext</b>
jpayne@68 64 functions attempt to translate a text string into the
jpayne@68 65 user&rsquo;s native language, by looking up the translation
jpayne@68 66 in a message catalog.</p>
jpayne@68 67
jpayne@68 68 <p style="margin-left:11%; margin-top: 1em">The
jpayne@68 69 <i>msgid</i> argument identifies the message to be
jpayne@68 70 translated. By convention, it is the English version of the
jpayne@68 71 message, with non-ASCII characters replaced by ASCII
jpayne@68 72 approximations. This choice allows the translators to work
jpayne@68 73 with message catalogs, called PO files, that contain both
jpayne@68 74 the English and the translated versions of each message, and
jpayne@68 75 can be installed using the <b>msgfmt</b> utility.</p>
jpayne@68 76
jpayne@68 77 <p style="margin-left:11%; margin-top: 1em">A message
jpayne@68 78 domain is a set of translatable <i>msgid</i> messages.
jpayne@68 79 Usually, every software package has its own message domain.
jpayne@68 80 The domain name is used to determine the message catalog
jpayne@68 81 where the translation is looked up; it must be a non-empty
jpayne@68 82 string. For the <b>gettext</b> function, it is specified
jpayne@68 83 through a preceding <b>textdomain</b> call. For the
jpayne@68 84 <b>dgettext</b> and <b>dcgettext</b> functions, it is passed
jpayne@68 85 as the <i>domainname</i> argument; if this argument is NULL,
jpayne@68 86 the domain name specified through a preceding
jpayne@68 87 <b>textdomain</b> call is used instead.</p>
jpayne@68 88
jpayne@68 89 <p style="margin-left:11%; margin-top: 1em">Translation
jpayne@68 90 lookup operates in the context of the current locale. For
jpayne@68 91 the <b>gettext</b> and <b>dgettext</b> functions, the
jpayne@68 92 <b>LC_MESSAGES</b> locale facet is used. It is determined by
jpayne@68 93 a preceding call to the <b>setlocale</b> function.
jpayne@68 94 <b>setlocale(LC_ALL,&quot;&quot;)</b> initializes the
jpayne@68 95 <b>LC_MESSAGES</b> locale based on the first nonempty value
jpayne@68 96 of the three environment variables <b>LC_ALL</b>,
jpayne@68 97 <b>LC_MESSAGES</b>, <b>LANG</b>; see <b>setlocale</b>(3).
jpayne@68 98 For the <b>dcgettext</b> function, the locale facet is
jpayne@68 99 determined by the <i>category</i> argument, which should be
jpayne@68 100 one of the <b>LC_xxx</b> constants defined in the
jpayne@68 101 &lt;locale.h&gt; header, excluding <b>LC_ALL</b>. In both
jpayne@68 102 cases, the functions also use the <b>LC_CTYPE</b> locale
jpayne@68 103 facet in order to convert the translated message from the
jpayne@68 104 translator&rsquo;s codeset to the current locale&rsquo;s
jpayne@68 105 codeset, unless overridden by a prior call to the
jpayne@68 106 <b>bind_textdomain_codeset</b> function.</p>
jpayne@68 107
jpayne@68 108 <p style="margin-left:11%; margin-top: 1em">The message
jpayne@68 109 catalog used by the functions is at the pathname
jpayne@68 110 <i>dirname</i>/<i>locale</i>/<i>category</i>/<i>domainname</i>.mo.
jpayne@68 111 Here <i>dirname</i> is the directory specified through
jpayne@68 112 <b>bindtextdomain</b>. Its default is system and
jpayne@68 113 configuration dependent; typically it is
jpayne@68 114 <i>prefix</i>/share/locale, where <i>prefix</i> is the
jpayne@68 115 installation prefix of the package. <i>locale</i> is the
jpayne@68 116 name of the current locale facet; the GNU implementation
jpayne@68 117 also tries generalizations, such as the language name
jpayne@68 118 without the territory name. <i>category</i> is
jpayne@68 119 <b>LC_MESSAGES</b> for the <b>gettext</b> and
jpayne@68 120 <b>dgettext</b> functions, or the argument passed to the
jpayne@68 121 <b>dcgettext</b> function.</p>
jpayne@68 122
jpayne@68 123 <p style="margin-left:11%; margin-top: 1em">If the
jpayne@68 124 <b>LANGUAGE</b> environment variable is set to a nonempty
jpayne@68 125 value, and the locale is not the &quot;C&quot; locale, the
jpayne@68 126 value of <b>LANGUAGE</b> is assumed to contain a colon
jpayne@68 127 separated list of locale names. The functions will attempt
jpayne@68 128 to look up a translation of <i>msgid</i> in each of the
jpayne@68 129 locales in turn. This is a GNU extension.</p>
jpayne@68 130
jpayne@68 131 <p style="margin-left:11%; margin-top: 1em">In the
jpayne@68 132 &quot;C&quot; locale, or if none of the used catalogs
jpayne@68 133 contain a translation for <i>msgid</i>, the <b>gettext</b>,
jpayne@68 134 <b>dgettext</b> and <b>dcgettext</b> functions return
jpayne@68 135 <i>msgid</i>.</p>
jpayne@68 136
jpayne@68 137 <h2>RETURN VALUE
jpayne@68 138 <a name="RETURN VALUE"></a>
jpayne@68 139 </h2>
jpayne@68 140
jpayne@68 141
jpayne@68 142 <p style="margin-left:11%; margin-top: 1em">If a
jpayne@68 143 translation was found in one of the specified catalogs, it
jpayne@68 144 is converted to the locale&rsquo;s codeset and returned. The
jpayne@68 145 resulting string is statically allocated and must not be
jpayne@68 146 modified or freed. Otherwise <i>msgid</i> is returned.</p>
jpayne@68 147
jpayne@68 148 <h2>ERRORS
jpayne@68 149 <a name="ERRORS"></a>
jpayne@68 150 </h2>
jpayne@68 151
jpayne@68 152
jpayne@68 153 <p style="margin-left:11%; margin-top: 1em"><b>errno</b> is
jpayne@68 154 not modified.</p>
jpayne@68 155
jpayne@68 156 <h2>BUGS
jpayne@68 157 <a name="BUGS"></a>
jpayne@68 158 </h2>
jpayne@68 159
jpayne@68 160
jpayne@68 161 <p style="margin-left:11%; margin-top: 1em">The return type
jpayne@68 162 ought to be <b>const char *</b>, but is <b>char *</b> to
jpayne@68 163 avoid warnings in C code predating ANSI C.</p>
jpayne@68 164
jpayne@68 165 <p style="margin-left:11%; margin-top: 1em">When an empty
jpayne@68 166 string is used for <i>msgid</i>, the functions may return a
jpayne@68 167 nonempty string.</p>
jpayne@68 168
jpayne@68 169 <h2>SEE ALSO
jpayne@68 170 <a name="SEE ALSO"></a>
jpayne@68 171 </h2>
jpayne@68 172
jpayne@68 173
jpayne@68 174
jpayne@68 175 <p style="margin-left:11%; margin-top: 1em"><b>ngettext</b>(3),
jpayne@68 176 <b>dngettext</b>(3), <b>dcngettext</b>(3),
jpayne@68 177 <b>setlocale</b>(3), <b>textdomain</b>(3),
jpayne@68 178 <b>bindtextdomain</b>(3), <b>bind_textdomain_codeset</b>(3),
jpayne@68 179 <b>msgfmt</b>(1)</p>
jpayne@68 180 <hr>
jpayne@68 181 </body>
jpayne@68 182 </html>