Next Previous Contents

5. National Language Support

To National Language Support (suvtomografia NLS) eivai mia duvatotnta pou exouv ta pio polla UNIX, wste va evnmerwvovtai oi efarmoges gia tis glwssikes ru8miseis tou xrnstn kai va parousiazouv ta muvnmata tous stnv avtistoixn glwssa.

To NLS xrnsimopoieitai apo polla GNU tools, eidika auta pou trexouv se periballov grammns evtolwv (Command Line Interface - CLI, dnladn to gvwsto prompt), kai upostnrizetai prosfata kai sto grafiko periballov (px KDE). H evnmerwsn twv efarmogwv givetai mesa apo metablntes periballovtos, me evtoles tou tupou LANG="el_GR". Apo Noembrn 1998 ta ellnvika 8a ru8mizovtai ws el_GR (me basn ta avtistoixa ISO protupa), kai elpizoume oti n allagn autn 8a perasei suvtoma stis diavomes.

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

PROSOXH: To parov kefalaio eixe graftei apo tov Taso Kapio, se mia epoxn pou to NLS dev upnrxe pavta stnmevo sto linux, kai to protupo ntav arketa asta8es (px, mporei va breite va leei gia gr_GR, avti el_GR).

5.1 Proetoimasia

PRWTA blepe poses kai poies eivai oi biblio8nkes tns C pou uparxouv sto sustnma sou. 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
Uparxouv 5 katngories libc kai dev eivai sumbates meta3u tous, osov afora ta locale pavta. (Autn tnv stigmn oi pio polloi exouv 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 ??? (sav libc 5 gia merikes arxitektovikes Linux)
  5. glibc 2.x.x (libc 6)

5.2 Egkatastasn Ellnvikwv Locale

Xreiazeste tis topikes ru8miseis (localedata), tov compiler localedef kai to diagvwstiko ergaleio locale.

Prwta pngaivete stov upokatalogo opou briskete gr_GR kai trexete tnv evtoln

   >sed -e 's/am_pm "";""/am_pm   "<P*><M*>";"<M*><M*>"/' gr_GR > el_GR
(Gia duvatotnta ellnvikou PM kai MM kai n allagn ovomatos gia sumbatotnta 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 sav root dnmiourgnste tous e3ns upokatalogous
   # 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
Egkatastnste sta swsta mern ta el_GR, en_DK, ISO-8859-7 (n ISO_8859-7:1987 n ISO_8859-7,1987)
# cd (ekei pou eivai 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, av dev ta exete ndn se binary morfn, ta locale kai localedef. Auto givetai peripou 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 tnv metaglwttisn twv topikwv ru8misewv. Sav root:
# cd /usr/share
Se periptwsn pou exete mia libc
# localedef -ci locale/el_GR -f i18n/charmap/ISO-8859-7 el_GR
Se periptwsn pou 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 va uparxouv auta 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 dokimn. Gia kelufos tupou csh p.x. tcsh:

> setenv LANG el_GR
Gia kelufos tupou 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
Kur;Deu;Tri;Tet;Pem;Par;Sab
Kuriakn;Deutera;Tritn;Tetartn;Pemptn;Paraskeun;Sabbato
Iav;Feb;Mar;Apr;Mai;Iouv;Ioul;Aug;Sep;Okt;Noe;Dek 
Iavouarios;Febrouarios;Martios;Aprilios;Maios;Iouvios;Ioulios;Augoustos;Septembrios;Oktwbrios;Noembrios;Dekembrios
PM;MM
%a %d %b %Y %T %Z
%d/%m/%Y
%T
(H diamorfwsn allazei apo libc se libc)

Twra mporeite va dokimaste merikes efarmoges (arkei va exouv givei compile me mia sumbatn libc)

> unsetenv LESSCHARSET n unset LESSCHARSET
> less kapoio-keimevo-me-ellnvika
> cal
   Augoustos 1997
Ku 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 ) avoi3te to Mail & Discussions kai 8a deite sto Date tous mnves stnv mesn px 31/08/1997 kai tis nmeres sta ellnvika. Telos :-)

Egkatastasn Ellnvikwv mnvumatwv diaforwv efarmogwv

Edw uparxouv duo ave3artnta paketa to gencat kai to gettext

a)To gencat erxetai mazi me tov pngaio kwdika tns ka8e libc (katw apo to nls/) n se binary p.x. gencat-x.y.z kai eivai e3artnmevo apo autnv opws kai to localedef. Metaglwttizei arxeia tupou International language text (.m) se katalogous.

b)To gettext, eivai ave3artnto apo tnv libc, kai uparxei suvn8ws se mirrors tns gnu p.x.ftp.kernel.org/pub/mirrors/gnu/gettext-0.10.tar.gz kai sta debian,redhat. (Gia va breite mia prosfatn ekdosn pate sto http://las.ml.org ya3te gia gettext) To xrnsimopoiouv sxedov ola ta paketa tns GNU {file,sh,text,net}-utils kai polla alla paketa p.x. (WindowMaker). Gia plnrofories deite to ftp.kernel.org/pub/mirrors/gnu/ABOUT-NLS, steilte mnvuma stnv ellnvikn omada sto [email protected] n gia va bon8nste mpeite stnv lista [email protected] me tnv le3n "subscribe" sto swma tou mnvumatos.

Autn tnv stigmn, apo o,ti gvwrizw, plnrws ellnvika mnvumata exei movo to tcsh 6.07.02 (me patches tou debian) kai xrnsimopoiei, dustuxws, to gencat.

5.3 Egkatastasn tou tcsh

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

Metaglwttiste, egkatastnste, 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 va afnvei grafete sta ellnvika)
 >fkjg
 fkjg: H evtoln de bre8nke.
Av dev sas bgalei ellnviko mnvuma tote

Av to mnvuma eivai kapws etsi

 fkjg: ^H ^e^v^t^o^l^n ^d^e ^b^r^e^8^n^k^e.
  1. Eleg3te ta permissions stnv /usr/share/locale/el_GR
     > ls -l /usr/share/locale/el_GR
     total 96
     drwxr-xr-x   3 root     root         1024 Iouv 25 20:40 ./
     drwxr-xr-x  68 root     root         2048 Aug   6 10:41 ../
     -rw-r--r--   1 root     root        29156 Iouv 25 20:36 LC_COLLATE
     -rw-r--r--   1 root     root        10428 Iouv 25 20:36 LC_CTYPE
     drwxr-xr-x   2 root     root         1024 Iouv 25 20:34 LC_MESSAGES/
     -rw-r--r--   1 root     root           95 Iouv 25 20:36 LC_MONETARY
     -rw-r--r--   1 root     root           27 Iouv 25 20:36 LC_NUMERIC
     -rw-r--r--   1 root     root          536 Iouv 25 20:36 LC_TIME
     -rw-r--r--   1 root     root        47443 Iouv 12 21:27 tcsh
    
  2. 3avakavete compile tis topikes ru8miseis me to localedef
  3. Eleg3te tnv ekdosn tou localedef kai tns libc wste va eivai 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 prosfatn ekdosn twv topikwv ru8misewv
  5. Avaba8miste tnv libc

5.4 Ru8miseis diaforwv efarmogwv

Oi pio polles efarmoges to movo pou xreiazovtai eivai to LANG se el_GR.

5.5 Problnmata

Polla ;-).

Problnmata me tnv C Library (libc)

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

Problnmata me ta X

Locale not supported from X library.(n kati paromoio) Eleg3te ta dikaiwmata stous upokatalogous

      # chmod -cR a+r /usr/share/locale /usr/X11R6/lib/locale
Eleg3te ta Xresources kai ya3te gia tipota upopto
      >xrdb -query
Blepe problnmata me tnv biblio8nkn tns C.

Problnmata pou dnmiourgouvtai otav ola eivai swsta ;-)

O daimovas syslogd apo8nkeuei ta dedomeva sta 7-bit kai polles efarmoges 8a tou stelvouv tis nmeromnvies sta ellnvika p.x.to PAM me apotelesma merikes fores va mnv mporeis deis tov mnva.

Merika programmata 8a perimevouv gia apavtnsn se erwtnsn "yes/no" avti gia "y" n "n"ta "v" kai "o" avtistoixa.

Stnv kovsola kalo eivai va exete mia grammatoseira iso-8859-7(ELOT-928). Eidika me ellnviko tcsh.

5.6 Epipleov plnrofories

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


Next Previous Contents