1 |
jkt 08/10/10 16:03:49 |
2 |
|
3 |
Modified: guide-localization.xml utf-8.xml |
4 |
Log: |
5 |
#208082: don't use LC_ALL, prefer system-wide LANG, don't set LC_CTYPE when LANG |
6 |
is already set, advertise utf-8 a bit more... |
7 |
|
8 |
Revision Changes Path |
9 |
1.49 xml/htdocs/doc/en/guide-localization.xml |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/guide-localization.xml?rev=1.49&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/guide-localization.xml?rev=1.49&content-type=text/plain |
13 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/guide-localization.xml?r1=1.48&r2=1.49 |
14 |
|
15 |
Index: guide-localization.xml |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v |
18 |
retrieving revision 1.48 |
19 |
retrieving revision 1.49 |
20 |
diff -u -r1.48 -r1.49 |
21 |
--- guide-localization.xml 4 Oct 2007 20:19:59 -0000 1.48 |
22 |
+++ guide-localization.xml 10 Oct 2008 16:03:49 -0000 1.49 |
23 |
@@ -1,5 +1,5 @@ |
24 |
<?xml version='1.0' encoding='UTF-8'?> |
25 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.48 2007/10/04 20:19:59 neysx Exp $ --> |
26 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/guide-localization.xml,v 1.49 2008/10/10 16:03:49 jkt Exp $ --> |
27 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
28 |
|
29 |
<guide link="/doc/en/guide-localization.xml"> |
30 |
@@ -29,8 +29,8 @@ |
31 |
the German doc. Includes configuration for use of the euro currency symbol. |
32 |
</abstract> |
33 |
|
34 |
-<version>1.36</version> |
35 |
-<date>2007-10-04</date> |
36 |
+<version>1.37</version> |
37 |
+<date>2008-10-10</date> |
38 |
|
39 |
<chapter> |
40 |
<title>Time zone</title> |
41 |
@@ -137,10 +137,10 @@ |
42 |
<th>Explanation</th> |
43 |
</tr> |
44 |
<tr> |
45 |
- <ti>LC_ALL</ti> |
46 |
+ <ti>LANG</ti> |
47 |
<ti> |
48 |
- Define all locale settings at once. This is the top level setting for |
49 |
- locales which will override any other setting. |
50 |
+ Defines all locale settings at once, while allowing further individual |
51 |
+ customization via the LC_* settings below. |
52 |
</ti> |
53 |
</tr> |
54 |
<tr> |
55 |
@@ -186,27 +186,32 @@ |
56 |
<ti>Defines default paper size.</ti> |
57 |
</tr> |
58 |
<tr> |
59 |
- <ti>LANG</ti> |
60 |
+ <ti>LC_ALL</ti> |
61 |
<ti> |
62 |
- Defines all locale settings at once. This setting can be overridden by |
63 |
- individual LC_* settings above or even by LC_ALL. |
64 |
+ A special variable for overriding all other settings. |
65 |
</ti> |
66 |
</tr> |
67 |
</table> |
68 |
|
69 |
<note> |
70 |
-Even though most programs work with LC_ALL only, some of them misbehave if |
71 |
-LC_ALL is set but LANG isn't. If you want to play safe, set them <e>both</e>. |
72 |
+Some programs are written in such a way that they expect traditional English |
73 |
+ordering of the alphabet, while some locales, most notably the Estonian one, use |
74 |
+a different ordering. Therefore it's recommended to explicitly set LC_COLLATE to C |
75 |
+when dealing with system-wide settings. |
76 |
</note> |
77 |
|
78 |
+<warn> |
79 |
+For the same reason, using LC_ALL is strongly discouraged. Please use it only |
80 |
+when testing and never set it in a startup file. |
81 |
+</warn> |
82 |
+ |
83 |
<p> |
84 |
-Most typically users only set the LANG variable and perhaps LC_CTYPE variable |
85 |
-on user level by adding definitions to shells startup files defining |
86 |
-the environment variable manually from command line: |
87 |
+Most typically users only set the LANG variable on the global basis: |
88 |
</p> |
89 |
|
90 |
-<pre caption="Setting the user locale in ~/.bashrc"> |
91 |
-export LANG="de_DE@euro" |
92 |
+<pre caption="Setting the default system locale in /etc/env.d/02locale"> |
93 |
+LANG="de_DE.utf8@euro" |
94 |
+LC_COLLATE="C" |
95 |
</pre> |
96 |
|
97 |
<note> |
98 |
@@ -215,19 +220,30 @@ |
99 |
</note> |
100 |
|
101 |
<p> |
102 |
-It is also possible to set a system-wide locale for all users and programs: |
103 |
+It's also possible, and pretty common especially in a more traditional UNIX |
104 |
+environment, to leave the global settings unchanged, i.e. in the "<c>C</c>" |
105 |
+locale. Users can still specify their preferred locale in their own shell RC |
106 |
+file: |
107 |
</p> |
108 |
|
109 |
-<pre caption="Setting the default system locale in /etc/env.d/02locale"> |
110 |
-LC_ALL="de_DE@euro" |
111 |
-LANG="de_DE@euro" |
112 |
+<pre caption="Setting the user locale in ~/.bashrc"> |
113 |
+export LANG="de_DE.utf8@euro" |
114 |
+export LC_COLLATE="C" |
115 |
+</pre> |
116 |
+ |
117 |
+<p> |
118 |
+Another way of configuring system is to leave it in the default C locale, but |
119 |
+enable UTF-8 character representation at the same time. This option is achieved |
120 |
+using the following settings in <path>/etc/env.d/02locale</path>: |
121 |
+</p> |
122 |
+ |
123 |
+<pre caption="Using traditional C locale while specifying UTF-8"> |
124 |
+LC_CTYPE=de_DE.utf8 |
125 |
</pre> |
126 |
|
127 |
<p> |
128 |
-A common practice is to use only per user locale settings and leave the |
129 |
-default system locale unset. In this case system locale defaults to a |
130 |
-special value <c>"C"</c>, which for historical reasons maps to the English |
131 |
-locale. |
132 |
+Using the above snippet, users will be able to see localized file names |
133 |
+properly, while not being forced to your preferred language. |
134 |
</p> |
135 |
|
136 |
<p> |
137 |
@@ -261,7 +277,7 @@ |
138 |
</p> |
139 |
|
140 |
<pre caption="Verify env changes"> |
141 |
-$ <i>env | grep -i LC_</i> |
142 |
+$ <i>locale</i> |
143 |
</pre> |
144 |
|
145 |
<p> |
146 |
|
147 |
|
148 |
|
149 |
1.49 xml/htdocs/doc/en/utf-8.xml |
150 |
|
151 |
file : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/utf-8.xml?rev=1.49&view=markup |
152 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/utf-8.xml?rev=1.49&content-type=text/plain |
153 |
diff : http://sources.gentoo.org/viewcvs.py/gentoo/xml/htdocs/doc/en/utf-8.xml?r1=1.48&r2=1.49 |
154 |
|
155 |
Index: utf-8.xml |
156 |
=================================================================== |
157 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v |
158 |
retrieving revision 1.48 |
159 |
retrieving revision 1.49 |
160 |
diff -u -r1.48 -r1.49 |
161 |
--- utf-8.xml 19 May 2008 21:08:38 -0000 1.48 |
162 |
+++ utf-8.xml 10 Oct 2008 16:03:49 -0000 1.49 |
163 |
@@ -1,5 +1,5 @@ |
164 |
<?xml version='1.0' encoding="UTF-8"?> |
165 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v 1.48 2008/05/19 21:08:38 swift Exp $ --> |
166 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/utf-8.xml,v 1.49 2008/10/10 16:03:49 jkt Exp $ --> |
167 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
168 |
|
169 |
<guide link="/doc/en/utf-8.xml"> |
170 |
@@ -25,8 +25,8 @@ |
171 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
172 |
<license /> |
173 |
|
174 |
-<version>2.25</version> |
175 |
-<date>2007-04-17</date> |
176 |
+<version>2.26</version> |
177 |
+<date>2008-10-10</date> |
178 |
|
179 |
<chapter> |
180 |
<title>Character Encodings</title> |
181 |
@@ -232,12 +232,13 @@ |
182 |
|
183 |
<p> |
184 |
There is one environment variable that needs to be set in order to use our new |
185 |
-UTF-8 locales: <c>LANG</c> (you can override this variable with the |
186 |
-<c>LC_ALL</c> setting as well). There are also many different ways to set it; |
187 |
-some people prefer to only have a UTF-8 environment for a specific user, in |
188 |
-which case they set them in their <path>~/.profile</path> (if you use |
189 |
-<c>/bin/sh</c>), <path>~/.bash_profile</path> or <path>~/.bashrc</path> (if you |
190 |
-use <c>/bin/bash</c>). |
191 |
+UTF-8 locales: <c>LC_CTYPE</c> (or optionally <c>LANG</c>, if you want to change |
192 |
+the system language as well). There are also many different ways to set it; some |
193 |
+people prefer to only have a UTF-8 environment for a specific user, in which |
194 |
+case they set them in their <path>~/.profile</path> (if you use <c>/bin/sh</c>), |
195 |
+<path>~/.bash_profile</path> or <path>~/.bashrc</path> (if you use |
196 |
+<c>/bin/bash</c>). More details and best practices can be found in our <uri |
197 |
+link="/doc/en/guide-localization.xml">Locallization Guide</uri>. |
198 |
</p> |
199 |
|
200 |
<p> |