Typo
[linux_from_scratch_hints.git] / OLD / lfs_frlocale_guide.txt
blob5a8f69f4a54534b7b894c6070df05593433ddcee
1 TITLE:          Locale Aware
2 LFS VERSION:    any
3 AUTHOR:         Yann Kerhervé <yk@cyberion.net>
5 SYNOPSIS:
6         How to customize your LFS system so that it is locale-aware (for non-US residents).
8 HINT:
9 *  A                   L O C A L E - A W A R E                   L F S  *
10 -------------------------------------------------------------------------
11 by Yann Kerhervé <yk@cyberion.net> - http://cyberion.net
13 $Id: lfs_frlocale_guide.txt,v 1.1 2003/09/15 04:49:15 tushar Exp $
18 I. Introduction
19 ---------------
21 I would like to express my thanks to several people :
22 - David Madore ( http://eleves.ens.fr/home/linux/)
23 - Guilhem Aznar (French-HOWTO)
24 - People on the LFS Mailing-List
26 Indeed, the information of this mini-guide comes from them.  This guide
27 is just a summarized, concise (but incomplete too) rewording. I hope this
28 doc will help  you to install a locale-aware LFS box.
30 In order to be the most complete, please, feel free to add your experiences,
31 corrections to this document. I juste retrace here the way I localized LFS
32 on my box (French), but if you have different hardware, different config.
33 different language too, contribute !
36 II. TODO
37 --------
39 Contributions are welcomed
41 - csh and other shells (I don't use those)
42 - other locales (I use fr_FR)
43 - rxvt and other terminals (Xterm for me) 
44 - emacs and other editors if necessary (vim for me)
45 - XFree 4 complete working solution
46 - Compiling installing and testing XFree3.3.6
47 - Add some explanations where it is necessary
48 - tidy my room (contributions welcomed too :)
51 III. The Kernel compilation
52 --------------------------
54 I always compile the kernel with the ISO-8859-1  support, and I add two
55 NLS : 437 (US : recommanded) and 850 (Europe : Adapt). I think this 
56 settings are only for the compatibility with Microsoft's product
57 (Filesystem).
60 IV. Glibc (2.1.3)
61 ------------------
63 What's described here can be done at any moment, as for me I do it as
64 soon as my LFS has been autonomous.
66 In the ./INSTALL, it's said :
68         # localedef -i de_DE -f ISO-8859-1 de_DE
70 for setting a classic german locale. So for a french one :
72         # localedef -i fr_FR -f ISO-8859-1 fr_FR
74 There is also another possibility, cd to the glibc-build directory and
75 issue :
77         # make localedata/install-locales
79 this should install all locales (supported by glibc) in your linux system.
81 Do you need this ? What are the symptoms if you need this ?  One of the
82 most important is perl complaints (quite annoying) that's to say :
84         perl: warning: Setting locale failed.  perl: warning: Please check
85         that your locale settings:
86             LC_ALL = "fr_FR",
87         LANG = (unset)
88             are supported and installed on your system.
89             perl: warning: Falling back to the standard locale ("C").
91 each time ou launch the perl interpreter.
93 The localdef command discribed above fix the problem for me.  (In the
94 bash I have exported the environnement variable : LANG, LANGUAGE, LC_ALL
95 to 'fr_FR').  Anothers fixes, if perl is too annoying, are described in
96 the perllocale page :
98         $ perldoc perllocale
100 for exemple export PERL_BADLANG if you want perl to be quiet
101 (dirty). Another solution is to change the locale to something installed
102 on your linux. For instance 'C'.
105 V. Gettext
106 ----------
108 I don't remember exactely when, but I have installed gettext in my
109 LFS system. I remember that I have installed it after all mandatory
110 software you should configure with the '--disable-nls' option.
111 I don't have the time to reinstall my LFS system since it takes a lot
112 of time. But, It could be interesting if someone tests something :
113 compiling and installing gettext as soon as possible. Indeed, when
114 I installed it, I were forced to reconfigure and reinstall every
115 software without the '--disable-nls' option.
117 Please, send me feedbacks.
120 VI. The console and the shell
121 -----------------------------
123 The set up of the console is quite easy, but results may vary according
124 to the way you do it.
126 * GOALS
128 My goals were : 
129 - a <backspace> erasing left 
130 - a <del/suppr> key erasing right 
131 - <home> and <end> moving the cursor to the beginning or the end
132   of the prompt line 
133 - accented keys working : éàè and ç 
134 - a working meta <Alt Gr> for generating <2>->'~', <3>->'#' and so on
135 - deadkeys enabled : ^e ¨o ...
137 The French-Howto was quite handy for reaching these goals.  Everything is
138 done with : 
139 - loadkeys : for loading a map in the kernel 
140 - setfont : changing the console font - be precautionous 
141 - readline configuration : INPUTRC
143 * LOADKEYS
145 loadkeys loads a map in the kernel. Be sure to install the last version of
146 kbd (0.95, at the moment I'm writing these lines) working with your kernel
147 (2.2.15).  This package provides a large set of maps and fonts. Please
148 refer to the loadkeys manpage for more information
150 As french user, I use the 'fr-latin1' map
152 You can find my trivial /etc/init.d/keymaps, sligthy modified from the
153 debian's one, with this document (in the tarball).
155 install a link in ./rcS.d/S06keymaps for example (keymaps should be
156 loaded as soon as possible)
158 * CONSOLEFONTS
160 As for the font, you can change them according to your needs
161 (slackware-like:) But be carreful, some fonts may be incompatible
162 with your locale.  If you cannot see any change while you're changing
163 those fonts, It's perhaps because you use the linux FB (Frame Buffer -
164 /usr/src/linux/Documentation/fb).  BUT, changing those fonts may alter
165 your localisation (I'm not sure, nevertheless).
167 As for me, I don't change the kernel default.
170 * READLINE (bash)
172 You should find in the tarball my rc scripts for bash. In these scripts a
173 Environnement variable is set : $INPUTRC. Inputrc is used by readline
174 for the customization at the init. If the INPUTRC is not set, then by
175 default readline will have a look to $HOME/.inputrc
177 here is my system wide /etc/inputrc (FRENCH-Howto):
179         # ---- Begin  /etc/inputrc 
180         
181         set convert-meta off
182         set meta-flag on
183         # Be 8 bit clean.
184         set input-meta on
185         set output-meta on
187         # home key
188         "\e[1~":beginning-of-line
189         # insert key
190         "\e[2~":kill-whole-line
191         # del key
192         "\e[3~":delete-char
193         # end key
194         "\e[4~":end-of-line
195         # pgup key
196         "\e[5~":history-search-forward
197         # pgdn key
198         "\e[6~":history-search-backward
200         # ---- End  /etc/inputrc 
202 with these settings everything should be ok for a french LFS user... ok,
203 in the console, problems come now :(
206 VII. X11 
207 --------
209 I experienced difficulties with XF4 with deadkeys, so you will
210 find below, the settings of two different version of XF.
212 * XFree86 4
214 With XFree86, I have almost perfect settings. But, there is just dead-keys
215 which don't work.
217 The configuration file syntax has changed with this new version.  For the
218 key board, here is settings ok for french people :
220         Option "XkbRules"   "xfree86"
221         Option "XkbModel"   "pc101"
222         Option "XkbLayout"  "fr"
225 * XTerm
227 BUT, if you're using xterm, you've to change several things. Here are the
228 real difficulties. I don't know the inner working of that, but the David
229 Madore's solution (http://eleves.ens.fr:8080/home/madore) is quite ok!
231 You have to change the /etc/termcap of your system (installed by termcap)
232 so with my LFS 2.3.1, I use termcap-1.3 You should find with this document
233 the fixed termcap (in the tarball)
235 here are the diffs : in the section xterm and xterm color:
237         xterm|vs100|xterm terminal emulator (X11R6 Window System):\
238                 :am:km:mi:ms:xn:xo:\
239                 :co#80:it#8:li#24:\
240                 :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\
241                 :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\
242                 :bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\
243                 :cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\
244                 :ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:\
245                 :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\
246                 :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\
247                 :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kI=\E[2~:\
248                 :kN=\E[6~:kP=\E[5~:kb=^?:kD=\E[3~:kd=\EOB:ke=\E[?1l\E>:\
249                 :kh=\E[1~:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:\
250                 :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\
251                 :se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\
252                 :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[m:up=\E[A:\
253                 :us=\E[4m:@7=\E[4~:
254         
255         # From: Eric S. Raymond <esr@snark.thyrsus.com> May 4 1995
256         # Should work with the color xterm on the X11R6 contrib tape.
257         xterm-color|xterm with color support:\
258                 :tc=xterm:ut:Co#8:pa#64:vi=\E[?25l:ve=\E[?25h:op=\E[39;49m:\
259                 :AB=\E[4%dm:AF=\E[3%dm:
261 I experiences difficulties with xterm. so I had to modify the app-defaults.
262 Enclosed, you should fine my entire .Xresources, here is the real point :
264         *VT100.Translations: #override\n\
265         <Key>BackSpace: string(0x7f)\n\
266         Ctrl<Key>Prior: string(0x1b) string("[40~")\n\
267         Ctrl<Key>Next: string(0x1b) string("[41~")\n\
268         Ctrl<Key>KP_Prior: string(0x1b) string("[40~")\n\
269         Ctrl<Key>KP_Next: string(0x1b) string("[41~")\n\
270         Ctrl<Key>Home: string(0x1b) string("[42~")\n\
271         Ctrl<Key>End: string(0x1b) string("[43~")\n\
272         Ctrl<Key>KP_Home: string(0x1b) string("[42~")\n\
273         Ctrl<Key>KP_End: string(0x1b) string("[43~")\n\
274         <Key>Delete: string(0x1b) string("[3~")\n\
275         <Key>Insert: string(0x1b) string("[2~")\n\
276         <Key>Home: string(0x1b) string("[1~")\n\
277         <Key>End: string(0x1b) string("[4~")\n\
278         :<Key>KP_Delete: string(0x1b) string("[3~")\n\
279         :<Key>KP_Insert: string(0x1b) string("[2~")\n\
280         :<Key>KP_Home: string(0x1b) string("[1~")\n\
281         :<Key>KP_End: string(0x1b) string("[4~")\n\
282         <Key>KP_Enter: string(0x0d)
285 As for me, this lines are in my $HOME/.Xressources, because, my
286 xinitrc (/etc/X11/xinit/xinitrc) specify :
288         (...)
289         sysresources=/usr/X11R6/lib/X11/xinit/.Xresources
290         (...)
291         if [ -f $sysresources ]; then
292                   xrdb -merge $sysresources
293         fi
294         (...)
296 According to David Madore's homepage, you shouldn't use .Xdefaults.
298 Another way is to modify - or create - the
299 -  /usr/X11R6/lib/X11/app-defaults/XTerm
300 -  /usr/X11R6/lib/X11/app-defaults/XTerm-color
302 (Every files in the app-default directory determines the way the apps
303 are looking by default)
305 Ok, now, with these settings, you should be quite happy - at least with
306 xterm, since almost all goals were reached.
308 * VIM Under Xterm
310 I had to fix vim in order to avoid the headache when editing a file under
311 xterm. Here is the trick :
313         " XTERM fix for deleting (yk)
314         if &term =~ "xterm"
315           set t_kb=DT
316           fixdel
317         endif
319         if &term =~ "xterm"
320           set t_kD=[3~
321         endif
323 You should have a copy of my complete vimrc. Ok, you should now
324 have a vim working under the console as well as under xterm.
326 TODO : I'm searching help with DEADKEYS 
328 *  XFree86 3.3.6 
330 I didn't change my termcap  and Xresources back, so I don't know If the
331 changes were necessary
333 TODO: to complete
336 VIII. Resources
337 ---------------
339 o Keyboard-and-Console-HOWTO : 
340   http://www.linuxdoc.org/HOWTO/Keyboard-and-Console-HOWTO.html
341   gives some explanations about kernel inner-working,
342   quite generic
344 o The David Madores's Excellent Home Page :
345   http://eleves.ens.fr:8080/home/madore/linux.html
346   This homepage receals treasures and some advices given
347   here, dealing with the french keyboard
348   
349 o The French-HOWTO : 
350   http://www.freenix.org/unix/linux/HOWTO/
351   A lot of application described, but a bit old
353 o VIM Homepage :
354   http://www.vim.org
356 o LFS :
357   http://www.linuxfromscratch.com