42
Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal [email protected]

Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal [email protected]

Embed Size (px)

Citation preview

Page 1: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux and Localization TutorialParas pradhan

Senior Linux DeveloperMadan puraskar pustakalaya

LalitpurNepal

[email protected]

Page 2: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:➔Operating system that was initially created by Linus Torvalds at early 90s ➔Name of the core kernel

➔If surrounded by utilities and applications then it is a distro

➔Linux = Linux is not Unix

➔Linux is free and Opensource

➔Cane be redistributed and modified

➔Based on GPL (GNU Public Licensed)

➔Comments from some experts:

"Linux, it turns out, was no intentional masterstroke, but an incremental process, a combination of experiments, ideas, and tiny scraps of code that gradually coalesced into an organic whole." - Glyn Moody, Wired

“Once the system is at the edge of chaos, we are bound to see surprises. Linux is one such system that has come to dazzle us all. “ – Ko Kuwabara

Page 3: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

➔History:

1971 - The first edition of the Unix server operating system emerges from Bell Labs.

1985 – Richard Stallman publishes his famous "GNU Manifesto", one of the first documents of the open-source revolution.

1991 - In August, Torvalds announces his plans to create a free operating system on the Minix users newsgroup. He modestly notes in his posting that his OS is "just a hobby”. In October, Linux 0.01 is released on the Internet under a GNU public license.

1992 + - Different Linux Distributions started . E.g: debian linux , slackware linux etc

About Linux:

contd...

Page 4: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...

➔ Official site kernel.org➔ Sister site linuxhq.com➔ Current Kernel version is 2.6.x

Page 5: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...

➔Linux distro: Collection of Linux Kernel + GNU softwares/tools. like:

➔Yast installer➔Kernel➔Gcc➔Kudzu➔Open Office➔GNU Cash➔Dpkg , Rpm➔Examples of Popular GNU/Linux Distributions

Debian GNU/Linux Redhat Linux SUSE linux

Page 6: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...➔Getting linux:

Internet Download CDROM CDROM in a Book

➔Which linux distro?

Depends upon useFor Servers, most popular are Redhat, Debian, FedoraFor Desktops, most popular are suse, mandrake, debian, mepis, knoppix etc

➔Installation:

From CD, internet Needs Linux native and swap filesystems

➔Package managers(most popular)pkgtool, autopackag etcrpm and dpkg

Page 7: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...➔Linux updating:

➔From packages➔From inernet using tools like up2date, redhat network, yum etc

➔Starting process of Linux:

1)Boot Manager 2)Kernel 3)Initialization Scripts 4)Login 5)Shell 6)Window Managers 7)Desktop 8)Applications

Page 8: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...➔Window managers and desktop environments:

➔windomaker➔gnome➔kde➔xface

➔Editors:➔pico, emacs, bluefish

➔Web browsers and mail clients:

➔Mozilla, firefox, thunderbird etc

Page 9: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

➔For programmers:➔c++ , python, php, perl etc➔Perl➔Python➔PHP➔Tcl➔Ada➔GDB➔Glade➔Tcl/Tk

➔Databases:

➔Mysql, oracle, postgre

About Linux:

contd...

Page 10: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...➔Gnu and openSource

➔Project in Free Software Foundation (FSF)

➔URL – http//www.gnu.org/fsf/fsf.html

➔Organization that maintain and collect many free software Ex. bash, gcc, linux, make and etc...

➔GNU stand for Gnu ‘s Not Unix

➔URL http://www.gnu.org

➔Initiated by Richard Stallman since 1984

➔GNU and OpenSource softwares can be available from freshmeat.net,sourceforge.net, gnu.org etc

Page 11: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...

➔OpenSource:

➔Source code of softwares available in openSource softwares➔Can be modified as per need➔Redistribute the modified software maintaining the licenscing criteria➔Commercial company make use of openSource software for ex: redhat, abria soft, miktotik etc

➔Uses of Linux at various sectors:

➔Education➔Data centeres➔ISPs➔Commercial appliance productions

Page 12: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Linux:

contd...

➔Linux and Networks:

➔ISPs and NSPs➔Web hosting company➔Big networks of school and universites➔Network servers and services as: PDC, DHCP, NAT, NIS, NFS, FTP etc➔Can support all network protocols as TCP/IP, IPX/SPX etc➔All protocols in Kernel➔QoS

Page 13: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

About Nepalinux:➔A linux distribution➔Mostly for Desktop usage➔Nepali unicode support➔Nepali user interfaces in many office and other applications like:

gnucash, nautils, gedit , openoffice etc➔Tools like nepali spellchecker , thesaurus for nepali language will be

integrated➔Can also be used by the community who doesn't know English➔Government , private sectors , education sector can use it freely

with no price➔Zero price or will be freely available for download or Cds from MPP➔Nepali unicode support➔Can run without installing to Hard disks

➔why nepalinux?

➔ Not bound to other commercial distributions➔ Zero price or free➔ Nepali Unicode support➔ Nepali utilities will be integrated

Page 14: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization➔i18n(Internationalization and why i18n:

➔User wants to work in his native language➔Most software assume user knows english➔I18nizing a program allows support for

➔Input➔Processing & Storage➔Display➔Printing

➔Potentially handle multiple languages, customs in the world➔Displaying characters for the users' native languages.➔Inputing characters for the users' native languages.➔Handling popular encodings for the users' native languages.➔Displaying messages in users' native languages.➔Character classification & sorting.➔Some the internationaliuzed softwares are:

➔gnome and gnome apps➔kde➔pango➔QT➔ICU

Page 15: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....

➔L10n (Localization) and why l10n:

➔Implementation of a specific language for an already internationalized software.

➔Adapting a program to a given culture➔Cultural Parameters➔Language rules➔Script – character set➔Date , time , currency➔Graphics & Icons

Page 16: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....➔GNU gettext for localization:

➔Tool to internationalize messages of the software outputs according to locale status

➔simple process:➔a) Coding using gettext support ( in C include <libintl.h>

#include <locale.h> ,#define _(String) gettext((String)) ) can be used

➔b) generate POT files of the program➔c) translate POT➔d) change it to PO and then MO➔e) copy it to related location➔f) test it using setting the locale and running the application

Page 17: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....

➔Locale:

➔Part of glibc➔Every lanugae must have it's own locale➔Many localized tools are dependent on locale➔Nepali locale developed and submitted by MPP and named as ne_NP➔Locale created using locale definiation file.

Page 18: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....➔Locale definiation file's contents and defniation

➔LC_CTYPE - Category related to encodings. Character testing functions such as islower() , multibyte character functions ➔LC_COLLATE - Category related to sorting. strcoll() ➔LC_MESSAGES - Category related to the language for messages the software

outputs. This category is used for gettext. ➔LC_MONETARY - Format to show monetary numbers,

Currency symbol,comma or period, columns,➔LC_NUMERIC - Number format to show, Position of decimal

Digit seperators

➔LC_TIME - Category related to format to show time and date, such as name of months and weeks, order of date, month, and year, and so on.

➔New categories➔LC_PAPER➔LC_IDENTIFICATION➔LC_ADDRESS

Page 19: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....➔Input system for Linux

➔Used for input of characters. In our case input of nepali characters➔There are many input systems

➔i) xkb➔ii)iiimf➔iii) scim

➔Xkb limitations➔Xkb and iiimf used at mpp for nepalinux

➔Both romanized and traditional keyboard layouts already developed

Page 20: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....

➔Fonts in Linux:

a)8bit TTF limited to 256 glyphs (200 usable)b)16bit Unicode TTF cover unicode ranges. upto 65,000 glyphsc)Opentype – for advanced typography GSUB, GPOS tables,useful for

complex scripts like Indic , Tibetan need cluster formation & ligature rules

➔Ttf and otf are being used for nepalinux➔Rules can be added to otf fonts

➔Types:➔bdf fonts:

➔rendered by X

Page 21: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

➔freetpye:➔ttf rendering➔rendering sclabale fonts➔anti aliasing➔suport for opentype table➔auto hinting

➔opentype:

➔otf fonts rendering➔opentype fonts rendered by xft/fontconfig➔gsub, gpos support➔rules based

➔tools:➔fontforge, fontlab etc

Basics of Linux Localization

contd....

Page 22: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....➔Gnome rendering, pango, freetype and xft:

➔rendering done in gnome by pango➔modular➔Text handling➔supports unicode chars ➔Supports bitmap, Type1 , TTF and OpenType fonts➔Rendering modules for Arabic, Indic, Thai, CJK etc➔rendering using FreeType library and Xft/Fontconfig

Page 23: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....➔Printing:

➔Gnome 2.8 use pango engine➔Gnome 2.6 uses libgnomeprint➔X apps use Xprint ( has dev support )➔KDE use Qprinter of QT➔Mozilla uses mozprint + xprint and pango➔Openoffice uses ICU

➔Gnome localization:

➔Status in l10n.gnome.org ➔Translation of gnome 2.8.x is being done➔Using POT files for tranlslation

tools used are poedit, kbabble etc

➔Kde localization:

➔not done

Page 24: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....➔Openoffice.org and localization

➔Complete office suite➔Replacement for MS Office➔Just announced the localization at l10n.openoffice.org➔Localization of 2.0➔Localization processs involved

➔a) Announcing➔b) Adding Languages➔c) Creation of openoffice locales➔d) UI translation➔e) Creating patch for localization➔f) Build the localized nepali openoffice

➔Will be integrated with nepalinux➔Will support almost all linux distribution and most probably for windows.➔Develop Nepali Spellchecker for openoffice.org

Page 25: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....

➔Mozilla localization, rendering , printing

➔Web browser with email client➔Most of the the localization is done at MPP➔Localization involves

➔a) Adding languange➔b) UI translation➔c) Enabling CTL and necessary parameters➔d) Build ➔e) Genereate the installter and localize the installer if possible

➔Version used is 1.7➔Rendering and printing done by mozprint, xprint and pango➔Printing support is not done completely at MPP and undergoing.

Page 26: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Basics of Linux Localization

contd....

➔Localization and translate tools:

➔Translate tool used for mozilla , openoffice , gnome apps etc➔Mozilla translator for mozilla➔Kabbel➔Gtranslator➔Poedit➔More

Page 27: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

➔Linux installation:

➔Boot from CD➔Make / , swap partitions and Linux native ext3 , Linux swap partition

and follow the normal process➔Select packages➔Install boot loader as grub, lilo etc

Page 28: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....➔Locale installation:

➔Locale defination file is ne_NP

➔Basic process ( distro neutral) :

a) Remove the previous one if exist

command: rm -rf /usr/lib/locale/ne_NP

b)cp /usr/share/i18n/charmaps/UTF-8.gz /tmp

c)/bin/gunzip -d /tmp/UTF-8.gz

d)Download ne_NP from http://www.nepalinux.org/ldf/ne_NP

e) /usr/bin/localedef -i ne_NP -f /tmp/UTF-8 /usr/lib/locale/ne_NP

f) check by using locale -a

Page 29: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....

➔Fonts installation:

➔Download samanata.ttf from http://www.nepalinux.org/fonts/samanata.ttf➔mkdir -p /usr/share/fonts/default/npfonts➔cp -f samanatha.ttf /usr/share/fonts/default/npfonts/➔fc-cache -f➔fc-list to view installed fonts

➔Note: On FC3 system download kalimati.otf file for better rendering and install

Page 30: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....➔Running Nepali Gnome:

1)export LC_ALL=ne_NP will change defaulf locale for nepali env.2)startx to see nepali Gnome

➔OR

1)Edit locale.aliases of gdm folder2)Add ' Nepali' ne_NP 3)Select Nepali on Languges select option of gdm login screen4)Login to see nepali Gnome

Page 31: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....

➔Input system:A) xkb

➔Note: only romanizied➔Download ne file from http://www.nepalinux.org/input/➔cp -f files/ne /usr/X11R6/lib/X11/xkb/symbols/pc➔cp -f files/ne /usr/X11R6/lib/X11/xkb/symbols➔ Add the following lins on /usr/X11R6/lib/X11/xkb/rules/xorg.xml

or /usr/X11R6/lib/X11/xkb/rules/xfree86.xml <layout> <configItem> <name>ne</name> <description>Nepali_Romanized</description> </configItem> <variantList/> </layout>

Page 32: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....

➔Adding Nepali Roman keyboard utility in Gnome desktop bottom panel

➔On the buttom panel right

1) Right click the mouse2) Click "Add to Panel"3) Click "Keyboard indicator"4) Click the "ADD" button5) Right click the added icon6) Click "Open keyboard preferences"7) Click the "Layout" tab8) Select "Nepali_Romanized" from available layouts9) Click "ADD and Close"10) Open Gedit and try to type, you will get Nepali characters11)Enjoy !

Page 33: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....B) iiimf:

➔Both traditional and romanzied can be done➔Download npkeybt.data and npkeybr.data from http://www.nepalinux.org/input➔Dowload required packages for iiimf

➔IIMF in Debian:

a) for debian (http://www.debian.org) iiimf-htt-csconv 11.4.1870-7 Codeset Conversion modules for IIIMF componentsii iiimf-htt-le-indic 11.4.1870-7 UNIT language engine for iiimf-htt-serverii iiimf-htt-server 11.4.1870-7 Htt input method serverii iiimf-htt-xbe 11.4.1870-7 IIIMF Htt XIM BackEnd module ii iiimgcf 11.4.1870-7 IIIM GTK+ 2.x Input Method Module Client

ii libiiimcf2 11.4.1870-7 Internet/Intranet Input Method Client Framework library

ii libiiimp0 11.4.1870-7 Internet/Intranet Input Method Protocol library

Page 34: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....b) install them using dpkg -i package namemkdir -p /usr/lib/im/locale/UNIT/NEPALI/datad) cp npkeybt.data /usr/lib/im/locale/UNIT/NEPALI/datae) cp npkeybr.data /usr/lib/im/locale/UNIT/NEPALI/dataf)add the following to /usr/lib/im/locale/UNIT/sysime.cfg

[ ne_NP ]npkeybt common/ctim.so NEPALInpkeybr common/ctim.so NEPALIRestart iiimf using, /etc/init.d/iiimf-htt-server start

e)Using iiimf:Open xtermexport GTK_IM_MODULE=iiimgedit , oowriter etcPress ctrl +o Press f5 and f6 to get nepali traditional and romanized input.

Page 35: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....

➔IIIMF in FC3:a)For fc3 download from (http://fedora.redhat.com) or from fc3 Cds.b)rpm -ivh iiim*c)mkdir -p /usr/lib/im/locale/UNIT/NEPALI/datad)cp npkeybt.data /usr/lib/im/locale/UNIT/NEPALI/datae)cp npkeybr.data /usr/lib/im/locale/UNIT/NEPALI/dataf)add the following to /usr/lib/im/locale/UNIT/sysime.cfg

[ ne_NP ]npkeybt common/ctim.so NEPALInpkeybr common/ctim.so NEPALI

g)Restart iiimf using, /etc/init.d/iiimf-htt-server start

Page 36: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

e)Using iiimf:

Create symlinks:

ln -s /etc/X11/xinit/xinput.d/iiimf /etc/alternatives/xinput-ne_NPln -s /etc/alternatives/xinput-ne_NP /etc/X11/xinit/xinput.d/ne_NP

OR

# Adding keyboard utility in Gnome desktop bottom panelOn the buttom panel right1) Right click the mouse2) Click "Add to Panel"3) Click "GTK input method"4) Click the "ADD" button5) Right click the added icon6) Select unitle7)Press f5 and f6 to get nepali traditional and romanized input.

Linux Localization Tutorial

contd....

Page 37: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....

➔Linux customization:

➔use of debootstrap and sid for debian➔knoppix or morphix customization➔Linux from scratch

Page 38: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

➔Translation of gnome or gnu apps

➔ using gettext toolscp /usr/share/locale/ne/LC_MESSAGES/gedit-2.6.mo /msgunfmt -o gedit-2.6.po gedit-2.6.moEdit the filemsgfmt -o gedit-2.6.mo gedit-2.6.pocp gedit-2.6.mo /usr/share/locale/ne/LC_MESSAGES/run gedit to check

Linux Localization Tutorial

contd....

Page 39: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Linux Localization Tutorial

contd....➔Nepalinux CD demo :

➔Based on debian sid and knoppix based morphix linux➔Live cd➔Can be install on hard disk

➔Nelp for fc3:

a) Download nelp1.tar.gz from http://www.nepalinux.org/fc3/b) tar -zxvf nelp1.tar.shc)cd nelp1d) ./nelp.sh keyhelpe) ./nelp.sh install

➔Debian Linux tutorials:

➔url ( debian.org)➔use of sid➔use of apt-get➔use of dpkg

Page 40: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Download this slide from:

http://www.nepalinux.org/linuxtutorial.ppt

Page 41: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Thank You

Page 42: Linux and Localization Tutorial Paras pradhan Senior Linux Developer Madan puraskar pustakalaya Lalitpur Nepal paras@mpp.org.np

Questions ?