Next Previous Contents

5. National Language Support

To National Language Support (syntomografia NLS) einai mia dynatothta poy exoyn ta pio polla UNIX, wste na enhmerwnontai oi efarmoges gia tis glwssikes ry8miseis toy xrhsth kai na paroysiazoyn ta mynhmata toys sthn antistoixh glwssa.

To NLS xrhsimopoieitai apo polla GNU tools, eidika ayta poy trexoyn se periballon grammhs entolwn (Command Line Interface - CLI, dhladh to gnwsto prompt), kai yposthrizetai prosfata kai sto grafiko periballon (px KDE). H enhmerwsh twn efarmogwn ginetai mesa apo metablhtes periballontos, me entoles toy tupoy LANG="el_GR". Apo Noembrh 1998 ta ellhnika 8a ry8mizontai ws el_GR (me bash ta antistoixa ISO protypa), kai elpizoyme oti h allagh ayth 8a perasei suntoma stis dianomes.

Ergasia gurw apo to NLS exei kanei kai o Simos 3enitellhs, deite to Greek-nls-HOWTO kai ayto to ar8ro sto periodiko magaz: http://magaz.hellug.gr/09/04_nls.html.

PROSOXH: To paron kefalaio eixe graftei apo ton Taso Kapio, se mia epoxh poy to NLS den yphrxe panta sthmeno sto linux, kai to protypo htan arketa asta8es (px, mporei na breite na leei gia gr_GR, anti el_GR).

5.1 Proetoimasia

PRWTA blepe poses kai poies einai oi biblio8hkes ths C poy yparxoyn sto susthma soy. p.x.

 ttyp3:~#ldconfig -v | grep libc.so
 libc.so.4 => libc.so.4.7.2
 libc.so.6 => libc-2.0.4.so
 libc.so.5 => libc.so.5.4.33
Yparxoyn 5 kathgories libc kai den einai symbates metaju toys, oson afora ta locale panta. (Ayth thn stigmh oi pio polloi exoyn tis ekdoseis 4 kai 5)
  1. libc 4 ??? (a.out)
  2. libc 5.0.9-5.3.12
  3. libc 5.4.x
  4. glibc 1.x ??? (san libc 5 gia merikes arxitektonikes Linux)
  5. glibc 2.x.x (libc 6)

5.2 Egkatastash Ellhnikwn Locale

Xreiazeste tis topikes ry8miseis (localedata), ton compiler localedef kai to diagnwstiko ergaleio locale.

Prwta phgainete ston ypokatalogo opoy briskete gr_GR kai trexete thn entolh

   >sed -e 's/am_pm "";""/am_pm   "<P*><M*>";"<M*><M*>"/' gr_GR > el_GR
(Gia dynatothta ellhnikou PM kai MM kai h allagh onomatos gia symbatothta me ta X) Kai gia elegxo
          > tail -n 5 el_GR | grep am_pm
          am_pm  "<P*><M*>";"<M*><M*>"
          t_fmt_ampm ""
          END LC_TIME
Twra san root dhmioyrghste toys ejhs ypokatalogoys
   # mkdir -m 755 -p /usr/share/locale/el_GR/LC_MESSAGES
   # mkdir -m 755 -p /usr/share/i18n/charmaps
   # mkdir -m 755 -p /usr/share/i18n/locales
   # ln -sf /usr/share/i18n/charmaps /usr/share/i18n/charmap
Egkatasthste sta swsta merh ta el_GR, en_DK, ISO-8859-7 (h ISO_8859-7:1987 h ISO_8859-7,1987)
# cd (ekei poy einai ta localedata)
# cp e?_??  /usr/share/i18n/locales
# cd ../charmaps
# cp ISO[-_]8859-7* /usr/share/i18n/charmaps
# cd /usr/share/i18n/charmaps
# ln -s ISO_8859-7,1987 ISO-8859-7
Metaglwttiste, an den ta exete hdh se binary morfh, ta locale kai localedef. Ayto ginetai peripoy etsi:
 > cd ~/src
 > gzip -dc libc-x.y.z.tar.gz | tar xvf -
 > cd libc-x.y.z
 > ./configure
 > make clean; make depend
 > cd locale
 > make programs
 > su -f root -c 'install -m 755 locale localedef /usr/bin'
Kai twra eiste etoimoi gia thn metaglwttish twn topikwn ry8misewn. San root:
# cd /usr/share
Se periptwsh poy exete mia libc
# localedef -ci locale/el_GR -f i18n/charmap/ISO-8859-7 el_GR
Se periptwsh poy exete duo p.x. libc-5.4.33 kai libc-2.0.4
# localedef-2.04   -ci el_GR -f ISO-8859-7 el_GR
# localedef-5.4.33 -ci el_GR -f ISO-8859-7 el
# chmod -cR a+r locale
Twra prepei na yparxoyn ayta katw apo to /usr/share/locale/el_GR (kai to el)
# ls locale/el_GR
LC_COLLATE    LC_CTYPE      LC_MESSAGES/  LC_MONETARY   LC_NUMERIC     LC_TIME

Mia dokimh. Gia kelyfos tupoy csh p.x. tcsh:

> setenv LANG el_GR
Gia kelyfos tupoy sh p.x. bash, ksh:
> LANG=el_GR ; export LANG
Dokimaste:
> locale
LANG=el_GR
LC_CTYPE="el_GR"
LC_NUMERIC="el_GR"
LC_TIME="el_GR"
LC_COLLATE="el_GR"
LC_MONETARY="el_GR"
LC_MESSAGES="el_GR"
LC_ALL=
> locale -c LC_TIME | head
LC_TIME
Kyr;Dey;Tri;Tet;Pem;Par;Sab
Kyriakh;Deytera;Trith;Tetarth;Pempth;Paraskeyh;Sabbato
Ian;Feb;Mar;Apr;Mai;Ioun;Ioul;Aug;Sep;Okt;Noe;Dek 
Ianoyarios;Febroyarios;Martios;Aprilios;Maios;Iounios;Ioulios;Augoystos;Septembrios;Oktwbrios;Noembrios;Dekembrios
PM;MM
%a %d %b %Y %T %Z
%d/%m/%Y
%T
(H diamorfwsh allazei apo libc se libc)

Twra mporeite na dokimaste merikes efarmoges (arkei na exoyn ginei compile me mia symbath libc)

> unsetenv LESSCHARSET h unset LESSCHARSET
> less kapoio-keimeno-me-ellhnika
> cal
   Augoystos 1997
Ky De Tr Te Pe Pa Sa 
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Kai sto Netscape 4 (me libc 5.4.x x > 4 ) anoijte to Mail & Discussions kai 8a deite sto Date toys mhnes sthn mesh px 31/08/1997 kai tis hmeres sta ellhnika. Telos :-)

Egkatastash Ellhnikwn mhnymatwn diaforwn efarmogwn

Edw yparxoyn dyo anejarthta paketa to gencat kai to gettext

a)To gencat erxetai mazi me ton phgaio kwdika ths ka8e libc (katw apo to nls/) h se binary p.x. gencat-x.y.z kai einai ejarthmeno apo aythn opws kai to localedef. Metaglwttizei arxeia tupoy International language text (.m) se katalogoys.

b)To gettext, einai anejarthto apo thn libc, kai yparxei synh8ws se mirrors ths gnu p.x.ftp.kernel.org/pub/mirrors/gnu/gettext-0.10.tar.gz kai sta debian,redhat. (Gia na breite mia prosfath ekdosh pate sto http://las.ml.org cajte gia gettext) To xrhsimopoioun sxedon ola ta paketa ths GNU {file,sh,text,net}-utils kai polla alla paketa p.x. (WindowMaker). Gia plhrofories deite to ftp.kernel.org/pub/mirrors/gnu/ABOUT-NLS, steilte mhnyma sthn ellhnikh omada sto el@li.org h gia na boh8hste mpeite sthn lista el-request@li.org me thn lejh "subscribe" sto swma toy mhnumatos.

Ayth thn stigmh, apo o,ti gnwrizw, plhrws ellhnika mhnumata exei mono to tcsh 6.07.02 (me patches toy debian) kai xrhsimopoiei, dystyxws, to gencat.

5.3 Egkatastash toy tcsh

Katebaste to tcsh >= 6.07.02. Breite to gencat (phgaios kwdikas libc,se binary apo redhat,debian) Protou metaglwttiste to tcsh. h

Metaglwttiste, egkatasthste, dokimaste to tcsh

 >make
 >make catalogs
 >su -f root -c 'make install'
 >su -f root -c 'install -m 644 tcsh.greek.cat /usr/share/locale/el_GR/tcsh'
 >/bin/tcsh
 >setenv LANG el_GR
 >unsetenv NOREBIND (gia na afhnei grafete sta ellhnika)
 >fkjg
 fkjg: H entolh de bre8hke.
An den sas bgalei ellhniko mhnyma tote

An to mhnyma einai kapws etsi

 fkjg: ^H ^e^n^t^o^l^h ^d^e ^b^r^e^8^h^k^e.
  1. Elegjte ta permissions sthn /usr/share/locale/el_GR
     > ls -l /usr/share/locale/el_GR
     total 96
     drwxr-xr-x   3 root     root         1024 Ioun 25 20:40 ./
     drwxr-xr-x  68 root     root         2048 Aug   6 10:41 ../
     -rw-r--r--   1 root     root        29156 Ioun 25 20:36 LC_COLLATE
     -rw-r--r--   1 root     root        10428 Ioun 25 20:36 LC_CTYPE
     drwxr-xr-x   2 root     root         1024 Ioun 25 20:34 LC_MESSAGES/
     -rw-r--r--   1 root     root           95 Ioun 25 20:36 LC_MONETARY
     -rw-r--r--   1 root     root           27 Ioun 25 20:36 LC_NUMERIC
     -rw-r--r--   1 root     root          536 Ioun 25 20:36 LC_TIME
     -rw-r--r--   1 root     root        47443 Ioun 12 21:27 tcsh
    
  2. 3anakanete compile tis topikes ry8miseis me to localedef
  3. Elegjte thn ekdosh toy localedef kai ths libc wste na einai idies
     > localedef -V
     localedef (GNU libc) 2.0.4
     Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
     This is free software; see the source for copying conditions.  There is NO
     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     Written by Ulrich Drepper.
     > ldd /bin/tcsh
            libnsl.so.1 => /lib/libnsl.so.1 (0x40003000)
            libncurses.so.4 => /usr/lib/libncurses.so.4 (0x4000a000)
            libcrypt.so.1 => /lib/libcrypt.so.1 (0x4004a000)
            libc.so.6 => /lib/libc.so.6 (0x40078000)
            /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
    
  4. Katebaste mia pio prosfath ekdosh twn topikwn ry8misewn
  5. Anaba8miste thn libc

5.4 Ry8miseis diaforwn efarmogwn

Oi pio polles efarmoges to mono poy xreiazontai einai to LANG se el_GR.

5.5 Problhmata

Polla ;-).

Problhmata me thn C Library (libc)

H METAGLWTTISMENH MORFH APO TA LOCALEDEF KAI GENCAT SYNH8WS ALLAZEI APO LIBC SE LIBC KAI ENA PROGRAMMA METAGLWTTISMENO ME TOYS HEADERS MIAS LIBC MPOREI NA MHN MPOREI NA DIABASEI THS TOPIKES RY8MISEIS FTIAGMENES APO ALLH BIBLIO8HKH.

Problhmata me ta X

Locale not supported from X library.(h kati paromoio) Elegjte ta dikaiwmata stoys ypokatalogoys

      # chmod -cR a+r /usr/share/locale /usr/X11R6/lib/locale
Elegjte ta Xresources kai cajte gia tipota upopto
      >xrdb -query
Blepe problhmata me thn biblio8hkh ths C.

Problhmata poy dhmioyrgountai otan ola einai swsta ;-)

O daimonas syslogd apo8hkeuei ta dedomena sta 7-bit kai polles efarmoges 8a toy stelnoyn tis hmeromhnies sta ellhnika p.x.to PAM me apotelesma merikes fores na mhn mporeis deis ton mhna.

Merika programmata 8a perimenoyn gia apanthsh se erwthsh "yes/no" anti gia "y" h "n"ta "n" kai "o" antistoixa.

Sthn konsola kalo einai na exete mia grammatoseira iso-8859-7(ELOT-928). Eidika me ellhniko tcsh.

5.6 Epipleon plhrofories

Yparxoyn ta man pages: locale.5 locale.7 setlocale.2


Next Previous Contents