Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/doc/gettext/gettext_2.html @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd"> | |
2 <html> | |
3 <!-- Created on February, 21 2024 by texi2html 1.78a --> | |
4 <!-- | |
5 Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author) | |
6 Karl Berry <karl@freefriends.org> | |
7 Olaf Bachmann <obachman@mathematik.uni-kl.de> | |
8 and many others. | |
9 Maintained by: Many creative people. | |
10 Send bugs and suggestions to <texi2html-bug@nongnu.org> | |
11 | |
12 --> | |
13 <head> | |
14 <title>GNU gettext utilities: 2. The User's View</title> | |
15 | |
16 <meta name="description" content="GNU gettext utilities: 2. The User's View"> | |
17 <meta name="keywords" content="GNU gettext utilities: 2. The User's View"> | |
18 <meta name="resource-type" content="document"> | |
19 <meta name="distribution" content="global"> | |
20 <meta name="Generator" content="texi2html 1.78a"> | |
21 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
22 <style type="text/css"> | |
23 <!-- | |
24 a.summary-letter {text-decoration: none} | |
25 pre.display {font-family: serif} | |
26 pre.format {font-family: serif} | |
27 pre.menu-comment {font-family: serif} | |
28 pre.menu-preformatted {font-family: serif} | |
29 pre.smalldisplay {font-family: serif; font-size: smaller} | |
30 pre.smallexample {font-size: smaller} | |
31 pre.smallformat {font-family: serif; font-size: smaller} | |
32 pre.smalllisp {font-size: smaller} | |
33 span.roman {font-family:serif; font-weight:normal;} | |
34 span.sansserif {font-family:sans-serif; font-weight:normal;} | |
35 ul.toc {list-style: none} | |
36 --> | |
37 </style> | |
38 | |
39 | |
40 </head> | |
41 | |
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> | |
43 | |
44 <table cellpadding="1" cellspacing="1" border="0"> | |
45 <tr><td valign="middle" align="left">[<a href="gettext_1.html#SEC1" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
46 <td valign="middle" align="left">[<a href="gettext_3.html#SEC16" title="Next chapter"> >> </a>]</td> | |
47 <td valign="middle" align="left"> </td> | |
48 <td valign="middle" align="left"> </td> | |
49 <td valign="middle" align="left"> </td> | |
50 <td valign="middle" align="left"> </td> | |
51 <td valign="middle" align="left"> </td> | |
52 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
53 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
54 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td> | |
55 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td> | |
56 </tr></table> | |
57 | |
58 <hr size="2"> | |
59 <a name="Users"></a> | |
60 <a name="SEC7"></a> | |
61 <h1 class="chapter"> <a href="gettext_toc.html#TOC7">2. The User's View</a> </h1> | |
62 | |
63 <p>Nowadays, when users log into a computer, they usually find that all | |
64 their programs show messages in their native language – at least for | |
65 users of languages with an active free software community, like French or | |
66 German; to a lesser extent for languages with a smaller participation in | |
67 free software and the GNU project, like Hindi and Filipino. | |
68 </p> | |
69 <p>How does this work? How can the user influence the language that is used | |
70 by the programs? This chapter will answer it. | |
71 </p> | |
72 | |
73 | |
74 <a name="System-Installation"></a> | |
75 <a name="SEC8"></a> | |
76 <h2 class="section"> <a href="gettext_toc.html#TOC8">2.1 Operating System Installation</a> </h2> | |
77 | |
78 <p>The default language is often already specified during operating system | |
79 installation. When the operating system is installed, the installer | |
80 typically asks for the language used for the installation process and, | |
81 separately, for the language to use in the installed system. Some OS | |
82 installers only ask for the language once. | |
83 </p> | |
84 <p>This determines the system-wide default language for all users. But the | |
85 installers often give the possibility to install extra localizations for | |
86 additional languages. For example, the localizations of KDE (the K | |
87 Desktop Environment) and LibreOffice are often bundled separately, as one | |
88 installable package per language. | |
89 </p> | |
90 <p>At this point it is good to consider the intended use of the machine: If | |
91 it is a machine designated for personal use, additional localizations are | |
92 probably not necessary. If, however, the machine is in use in an | |
93 organization or company that has international relationships, one can | |
94 consider the needs of guest users. If you have a guest from abroad, for | |
95 a week, what could be his preferred locales? It may be worth installing | |
96 these additional localizations ahead of time, since they cost only a bit | |
97 of disk space at this point. | |
98 </p> | |
99 <p>The system-wide default language is the locale configuration that is used | |
100 when a new user account is created. But the user can have his own locale | |
101 configuration that is different from the one of the other users of the | |
102 same machine. He can specify it, typically after the first login, as | |
103 described in the next section. | |
104 </p> | |
105 | |
106 <a name="Setting-the-GUI-Locale"></a> | |
107 <a name="SEC9"></a> | |
108 <h2 class="section"> <a href="gettext_toc.html#TOC9">2.2 Setting the Locale Used by GUI Programs</a> </h2> | |
109 | |
110 <p>The immediately available programs in a user's desktop come from a group | |
111 of programs called a “desktop environment”; it usually includes the window | |
112 manager, a web browser, a text editor, and more. The most common free | |
113 desktop environments are KDE, GNOME, and Xfce. | |
114 </p> | |
115 <p>The locale used by GUI programs of the desktop environment can be specified | |
116 in a configuration screen called “control center”, “language settings” | |
117 or “country settings”. | |
118 </p> | |
119 <p>Individual GUI programs that are not part of the desktop environment can | |
120 have their locale specified either in a settings panel, or through environment | |
121 variables. | |
122 </p> | |
123 <p>For some programs, it is possible to specify the locale through environment | |
124 variables, possibly even to a different locale than the desktop's locale. | |
125 This means, instead of starting a program through a menu or from the file | |
126 system, you can start it from the command-line, after having set some | |
127 environment variables. The environment variables can be those specified | |
128 in the next section (<a href="#SEC10">Setting the Locale through Environment Variables</a>); for some versions of | |
129 KDE, however, the locale is specified through a variable <code>KDE_LANG</code>, | |
130 rather than <code>LANG</code> or <code>LC_ALL</code>. | |
131 </p> | |
132 | |
133 <a name="Setting-the-POSIX-Locale"></a> | |
134 <a name="SEC10"></a> | |
135 <h2 class="section"> <a href="gettext_toc.html#TOC10">2.3 Setting the Locale through Environment Variables</a> </h2> | |
136 | |
137 <p>As a user, if your language has been installed for this package, in the | |
138 simplest case, you only have to set the <code>LANG</code> environment variable | |
139 to the appropriate ‘<samp><var>ll</var>_<var>CC</var></samp>’ combination. For example, | |
140 let's suppose that you speak German and live in Germany. At the shell | |
141 prompt, merely execute | |
142 ‘<samp>setenv LANG de_DE</samp>’ (in <code>csh</code>), | |
143 ‘<samp>export LANG; LANG=de_DE</samp>’ (in <code>sh</code>) or | |
144 ‘<samp>export LANG=de_DE</samp>’ (in <code>bash</code>). This can be done from your | |
145 ‘<tt>.login</tt>’ or ‘<tt>.profile</tt>’ file, once and for all. | |
146 </p> | |
147 | |
148 | |
149 <a name="Locale-Names"></a> | |
150 <a name="SEC11"></a> | |
151 <h3 class="subsection"> <a href="gettext_toc.html#TOC11">2.3.1 Locale Names</a> </h3> | |
152 | |
153 <p>A locale name usually has the form ‘<samp><var>ll</var>_<var>CC</var></samp>’. Here | |
154 ‘<samp><var>ll</var></samp>’ is an ISO 639 two-letter language code, and | |
155 ‘<samp><var>CC</var></samp>’ is an ISO 3166 two-letter country code. For example, | |
156 for German in Germany, <var>ll</var> is <code>de</code>, and <var>CC</var> is <code>DE</code>. | |
157 You find a list of the language codes in appendix <a href="gettext_18.html#SEC373">Language Codes</a> and | |
158 a list of the country codes in appendix <a href="gettext_19.html#SEC376">Country Codes</a>. | |
159 </p> | |
160 <p>You might think that the country code specification is redundant. But in | |
161 fact, some languages have dialects in different countries. For example, | |
162 ‘<samp>de_AT</samp>’ is used for Austria, and ‘<samp>pt_BR</samp>’ for Brazil. The country | |
163 code serves to distinguish the dialects. | |
164 </p> | |
165 <p>Many locale names have an extended syntax | |
166 ‘<samp><var>ll</var>_<var>CC</var>.<var>encoding</var></samp>’ that also specifies the character | |
167 encoding. These are in use because between 2000 and 2005, most users have | |
168 switched to locales in UTF-8 encoding. For example, the German locale on | |
169 glibc systems is nowadays ‘<samp>de_DE.UTF-8</samp>’. The older name ‘<samp>de_DE</samp>’ | |
170 still refers to the German locale as of 2000 that stores characters in | |
171 ISO-8859-1 encoding – a text encoding that cannot even accommodate the Euro | |
172 currency sign. | |
173 </p> | |
174 <p>Some locale names use ‘<samp><var>ll</var>_<var>CC</var>@<var>variant</var></samp>’ instead of | |
175 ‘<samp><var>ll</var>_<var>CC</var></samp>’. The ‘<samp>@<var>variant</var></samp>’ can denote any kind of | |
176 characteristics that is not already implied by the language <var>ll</var> and | |
177 the country <var>CC</var>. It can denote a particular monetary unit. For example, | |
178 on glibc systems, ‘<samp>de_DE@euro</samp>’ denotes the locale that uses the Euro | |
179 currency, in contrast to the older locale ‘<samp>de_DE</samp>’ which implies the use | |
180 of the currency before 2002. It can also denote a dialect of the language, | |
181 or the script used to write text (for example, ‘<samp>sr_RS@latin</samp>’ uses the | |
182 Latin script, whereas ‘<samp>sr_RS</samp>’ uses the Cyrillic script to write Serbian), | |
183 or the orthography rules, or similar. | |
184 </p> | |
185 <p>On other systems, some variations of this scheme are used, such as | |
186 ‘<samp><var>ll</var></samp>’. You can get the list of locales supported by your system | |
187 for your language by running the command ‘<samp>locale -a | grep '^<var>ll</var>'</samp>’. | |
188 </p> | |
189 <p>There is also a special locale, called ‘<samp>C</samp>’. | |
190 When it is used, it disables all localization: in this locale, all programs | |
191 standardized by POSIX use English messages and an unspecified character | |
192 encoding (often US-ASCII, but sometimes also ISO-8859-1 or UTF-8, depending on | |
193 the operating system). | |
194 </p> | |
195 | |
196 <a name="Locale-Environment-Variables"></a> | |
197 <a name="SEC12"></a> | |
198 <h3 class="subsection"> <a href="gettext_toc.html#TOC12">2.3.2 Locale Environment Variables</a> </h3> | |
199 | |
200 <p>A locale is composed of several <em>locale categories</em>, see <a href="gettext_1.html#SEC4">Aspects in Native Language Support</a>. | |
201 When a program looks up locale dependent values, it does this according to | |
202 the following environment variables, in priority order: | |
203 </p> | |
204 <ol> | |
205 <li><a name="IDX33"></a> | |
206 </li><li> <code>LANGUAGE</code> | |
207 <a name="IDX34"></a> | |
208 </li><li> <code>LC_ALL</code> | |
209 <a name="IDX35"></a> | |
210 <a name="IDX36"></a> | |
211 <a name="IDX37"></a> | |
212 <a name="IDX38"></a> | |
213 <a name="IDX39"></a> | |
214 <a name="IDX40"></a> | |
215 </li><li> <code>LC_xxx</code>, according to selected locale category: | |
216 <code>LC_CTYPE</code>, <code>LC_NUMERIC</code>, <code>LC_TIME</code>, <code>LC_COLLATE</code>, | |
217 <code>LC_MONETARY</code>, <code>LC_MESSAGES</code>, ... | |
218 <a name="IDX41"></a> | |
219 </li><li> <code>LANG</code> | |
220 </li></ol> | |
221 | |
222 <p>Variables whose value is set but is empty are ignored in this lookup. | |
223 </p> | |
224 <p><code>LANG</code> is the normal environment variable for specifying a locale. | |
225 As a user, you normally set this variable (unless some of the other variables | |
226 have already been set by the system, in ‘<tt>/etc/profile</tt>’ or similar | |
227 initialization files). | |
228 </p> | |
229 <p><code>LC_CTYPE</code>, <code>LC_NUMERIC</code>, <code>LC_TIME</code>, <code>LC_COLLATE</code>, | |
230 <code>LC_MONETARY</code>, <code>LC_MESSAGES</code>, and so on, are the environment | |
231 variables meant to override <code>LANG</code> and affecting a single locale | |
232 category only. For example, assume you are a Swedish user in Spain, and you | |
233 want your programs to handle numbers and dates according to Spanish | |
234 conventions, and only the messages should be in Swedish. Then you could | |
235 create a locale named ‘<samp>sv_ES</samp>’ or ‘<samp>sv_ES.UTF-8</samp>’ by use of the | |
236 <code>localedef</code> program. But it is simpler, and achieves the same effect, | |
237 to set the <code>LANG</code> variable to <code>es_ES.UTF-8</code> and the | |
238 <code>LC_MESSAGES</code> variable to <code>sv_SE.UTF-8</code>; these two locales come | |
239 already preinstalled with the operating system. | |
240 </p> | |
241 <p><code>LC_ALL</code> is an environment variable that overrides all of these. | |
242 It is typically used in scripts that run particular programs. For example, | |
243 <code>configure</code> scripts generated by GNU autoconf use <code>LC_ALL</code> to make | |
244 sure that the configuration tests don't operate in locale dependent ways. | |
245 </p> | |
246 <p>Some systems, unfortunately, set <code>LC_ALL</code> in ‘<tt>/etc/profile</tt>’ or in | |
247 similar initialization files. As a user, you therefore have to unset this | |
248 variable if you want to set <code>LANG</code> and optionally some of the other | |
249 <code>LC_xxx</code> variables. | |
250 </p> | |
251 <p>The <code>LANGUAGE</code> variable is described in the next subsection. | |
252 </p> | |
253 | |
254 <a name="The-LANGUAGE-variable"></a> | |
255 <a name="SEC13"></a> | |
256 <h3 class="subsection"> <a href="gettext_toc.html#TOC13">2.3.3 Specifying a Priority List of Languages</a> </h3> | |
257 | |
258 <p>Not all programs have translations for all languages. By default, an | |
259 English message is shown in place of a nonexistent translation. If you | |
260 understand other languages, you can set up a priority list of languages. | |
261 This is done through a different environment variable, called | |
262 <code>LANGUAGE</code>. GNU <code>gettext</code> gives preference to <code>LANGUAGE</code> | |
263 over <code>LC_ALL</code> and <code>LANG</code> for the purpose of message handling, | |
264 but you still need to have <code>LANG</code> (or <code>LC_ALL</code>) set to the primary | |
265 language; this is required by other parts of the system libraries. | |
266 For example, some Swedish users who would rather read translations in | |
267 German than English for when Swedish is not available, set <code>LANGUAGE</code> | |
268 to ‘<samp>sv:de</samp>’ while leaving <code>LANG</code> to ‘<samp>sv_SE</samp>’. | |
269 </p> | |
270 <p>Special advice for Norwegian users: The language code for Norwegian | |
271 bokmål changed from ‘<samp>no</samp>’ to ‘<samp>nb</samp>’ recently (in 2003). | |
272 During the transition period, while some message catalogs for this language | |
273 are installed under ‘<samp>nb</samp>’ and some older ones under ‘<samp>no</samp>’, it is | |
274 recommended for Norwegian users to set <code>LANGUAGE</code> to ‘<samp>nb:no</samp>’ so that | |
275 both newer and older translations are used. | |
276 </p> | |
277 <p>In the <code>LANGUAGE</code> environment variable, but not in the other | |
278 environment variables, ‘<samp><var>ll</var>_<var>CC</var></samp>’ combinations can be | |
279 abbreviated as ‘<samp><var>ll</var></samp>’ to denote the language's main dialect. | |
280 For example, ‘<samp>de</samp>’ is equivalent to ‘<samp>de_DE</samp>’ (German as spoken in | |
281 Germany), and ‘<samp>pt</samp>’ to ‘<samp>pt_PT</samp>’ (Portuguese as spoken in Portugal) | |
282 in this context. | |
283 </p> | |
284 <p>Note: The variable <code>LANGUAGE</code> is ignored if the locale is set to | |
285 ‘<samp>C</samp>’. In other words, you have to first enable localization, by setting | |
286 <code>LANG</code> (or <code>LC_ALL</code>) to a value other than ‘<samp>C</samp>’, before you can | |
287 use a language priority list through the <code>LANGUAGE</code> variable. | |
288 </p> | |
289 | |
290 <a name="Working-in-a-Windows-console"></a> | |
291 <a name="SEC14"></a> | |
292 <h2 class="section"> <a href="gettext_toc.html#TOC14">2.4 Obtaining good output in a Windows console</a> </h2> | |
293 | |
294 <p>On Windows, consoles such as the one started by the <code>cmd.exe</code> | |
295 program do input and output in an encoding, called “OEM code page”, | |
296 that is different from the encoding that text-mode programs usually use, | |
297 called “ANSI code page”. (Note: This problem does not exist for | |
298 Cygwin consoles; these consoles do input and output in the UTF-8 | |
299 encoding.) As a workaround, you may request that the programs produce | |
300 output in this “OEM” encoding. To do so, set the environment variable | |
301 <code>OUTPUT_CHARSET</code> to the “OEM” encoding, through a command such as | |
302 </p><table><tr><td> </td><td><pre class="smallexample">set OUTPUT_CHARSET=CP850 | |
303 </pre></td></tr></table> | |
304 <p>Note: This has an effect only on strings looked up in message catalogs; | |
305 other categories of text are usually not affected by this setting. | |
306 Note also that this environment variable also affects output sent to a | |
307 file or to a pipe; output to a file is most often expected to be in the | |
308 “ANSI” or in the UTF-8 encoding. | |
309 </p> | |
310 <p>Here are examples of the “ANSI” and “OEM” code pages: | |
311 </p> | |
312 <table> | |
313 <thead><tr><th><p> Territories </p></th><th><p> ANSI encoding </p></th><th><p> OEM encoding | |
314 </p></th></tr></thead> | |
315 <tr><td><p> Western Europe </p></td><td><p> CP1252 </p></td><td><p> CP850 | |
316 </p></td></tr> | |
317 <tr><td><p> Slavic countries (Latin 2) </p></td><td><p> CP1250 </p></td><td><p> CP852 | |
318 </p></td></tr> | |
319 <tr><td><p> Baltic countries </p></td><td><p> CP1257 </p></td><td><p> CP775 | |
320 </p></td></tr> | |
321 <tr><td><p> Russia </p></td><td><p> CP1251 </p></td><td><p> CP866 | |
322 </p></td></tr> | |
323 </table> | |
324 | |
325 | |
326 <a name="Installing-Localizations"></a> | |
327 <a name="SEC15"></a> | |
328 <h2 class="section"> <a href="gettext_toc.html#TOC15">2.5 Installing Translations for Particular Programs</a> </h2> | |
329 | |
330 <p>Languages are not equally well supported in all packages using GNU | |
331 <code>gettext</code>, and more translations are added over time. Usually, you | |
332 use the translations that are shipped with the operating system | |
333 or with particular packages that you install afterwards. But you can also | |
334 install newer localizations directly. For doing this, you will need an | |
335 understanding where each localization file is stored on the file system. | |
336 </p> | |
337 <a name="IDX42"></a> | |
338 <p>For programs that participate in the Translation Project, you can start | |
339 looking for translations here: | |
340 <a href="https://translationproject.org/team/index.html">https://translationproject.org/team/index.html</a>. | |
341 </p> | |
342 <p>For programs that are part of the KDE project, the starting point is: | |
343 <a href="https://l10n.kde.org/">https://l10n.kde.org/</a>. | |
344 </p> | |
345 <p>For programs that are part of the GNOME project, the starting point is: | |
346 <a href="https://wiki.gnome.org/TranslationProject">https://wiki.gnome.org/TranslationProject</a>. | |
347 </p> | |
348 <p>For other programs, you may check whether the program's source code package | |
349 contains some ‘<tt><var>ll</var>.po</tt>’ files; often they are kept together in a | |
350 directory called ‘<tt>po/</tt>’. Each ‘<tt><var>ll</var>.po</tt>’ file contains the | |
351 message translations for the language whose abbreviation of <var>ll</var>. | |
352 </p> | |
353 | |
354 <table cellpadding="1" cellspacing="1" border="0"> | |
355 <tr><td valign="middle" align="left">[<a href="#SEC7" title="Beginning of this chapter or previous chapter"> << </a>]</td> | |
356 <td valign="middle" align="left">[<a href="gettext_3.html#SEC16" title="Next chapter"> >> </a>]</td> | |
357 <td valign="middle" align="left"> </td> | |
358 <td valign="middle" align="left"> </td> | |
359 <td valign="middle" align="left"> </td> | |
360 <td valign="middle" align="left"> </td> | |
361 <td valign="middle" align="left"> </td> | |
362 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Top" title="Cover (top) of document">Top</a>]</td> | |
363 <td valign="middle" align="left">[<a href="gettext_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td> | |
364 <td valign="middle" align="left">[<a href="gettext_21.html#SEC389" title="Index">Index</a>]</td> | |
365 <td valign="middle" align="left">[<a href="gettext_abt.html#SEC_About" title="About (help)"> ? </a>]</td> | |
366 </tr></table> | |
367 <p> | |
368 <font size="-1"> | |
369 This document was generated by <em>Bruno Haible</em> on <em>February, 21 2024</em> using <a href="https://www.nongnu.org/texi2html/"><em>texi2html 1.78a</em></a>. | |
370 </font> | |
371 <br> | |
372 | |
373 </p> | |
374 </body> | |
375 </html> |