The intent is to serve as an introduction for people involved in the Rebati project. At this point of time the project is in its infancy, but the aim is to eventually have a Linux distribution that is entirely in Oriya at all levels, including GUI menus and messages. Hopefully, this will make technology available to the majority of people in Orissa who are not conversant with English. There have been several efforts to support Indian languages, including Oriya, and after a consideration of these, this project will be tied to the IndLinux project [1]. It might also be possible to port a lot of this work to Microsoft Windows under CyGNOME [2].
Why Linux? To date, most commercial software is written in Western countries. As a consequence, these are typically not affordable to people in developing countries, leading to widespread software piracy. Besides the immoral aspects of such unauthorized copying of software, the day is not far off when India will be forced to crack down on such practices. Further, the source code of such commercial software is unavailable to the end-user, ensuring that she remains at the mercy of the developer. Open-source operating systems and software offer an attractive alternative, as the end-user can actively participate in software development, and any kind of centralized controlling authority becomes impossible. Linguistic groups that were considered too small a market by software vendors can now control their own destiny by customizing open-source software to their needs. Also, the fact that most open-source software also comes free of charge, offers a great economic advantage, especially in a poor country like India. Linux, as compared to other open-source platforms, is seen as the best alternative, due to its popularity among developers and users. There is an existing framework for the internationalization of Linux that can be adapted to Indian languages without undue difficulty.
Here, we describe the essential first steps for using Oriya under Linux. We discuss available fonts and related software, methods for the input of Oriya characters and Oriya locales, and conclude with a brief outline of other tasks such as translations of program messages as well as documentation. Major linguistic issues such as developing a glossary and dictionary, defining a collation order for the Oriya alphabet, etc., have not been considered here, due to a lack of expertise, and space to do justice to them.
This document is intended to allow the reader to quickly get started, and does not go into a lot of depth on most issues. Also, while the steps involved should be similar, regardless of the Linux distribution in use, the exact ones described here were used under PCQLinux 2004, which is based on Redhat Fedora Core 2. Most of the instructions have also been tried out on older Redhat systems from 8.0 onwards. Other distributions might have different locations for some of the files.
The currently existing system of fonts used for display on computer screens, and for printing. is largely a consequence of the unanticipated growth in the popularity of the computer and its widespread use for desktop publishing. Inadequate provisions had been made for the future at the time of the introduction of computers, and these problems were exacerbated by the use of temporary, makeshift, and closed-source, proprietary solutions by Adobe, Apple and Microsoft. Here, we describe the major font technologies and encodings in use today.
The principal failing of bitmap fonts is that they do not scale well in size. As the shape of the glyph really consists of rectangular pixels, a significant increase in the size of the font results in this granularity becoming visible as jaggedness in the outline of the characters. Thus, the font designer is forced to create a series of fonts at each of several different sizes. However, such fonts are well-suited for most computer display systems and are still widely used there.
Postscript fonts mathematically describe the outline of the glyph, and are typically used to print with laser printers. Such fonts can be scaled to an arbitrary size, and are usually supplied in different weights and styles, e.g., Roman, bold, italic, etc. Postscript fonts were later enhanced by techniques like hinting, where the outline of a glyph is algorithmically fitted into the available pixel-spacing so as to give the most pleasing shape. Likewise, font metric files are used to supply additional information regarding the font's line breaks and spacing, as well as kerning tables and character-width information.
TrueType fonts were developed by Apple as a replacement for Postscript. They use splines to mathematically describe the outline shape, and include both the mathematical description of the glyphs as well as the bit-mapped display font in a single file.
OpenType [6,7] fonts are the latest font-scaling system developed jointly by Adobe and Microsoft, and also supported on newer Apple computers. OpenType is an amalgamation of features from Postscript and TrueType, and will hopefully eliminate the font-type wars. The possibility of defining rules for complex glyphs or combinations of different glyphs afforded by OpenType makes it the best current solution for Indian language fonts. Microsoft offers a list of frequently asked questions about OpenType [8], detailed OpenType specifications [7], as well as an in-depth article on the subject of the support and development of fonts for Indian languages [9]. A detailed list of OpenType fonts and software is offered by Luc Devroye [10]
This plethora of encodings led to difficulties in interoperability of computers, as a result of which the 16-bit Unicode (ISO 10646) standard [12] was created to cover every character in all languages used anywhere in the world.
The built-in assumption for the X11 font system is that each glyph in a font corresponds to a unique character in the set. This does not work for Indian languages where the sequence of characters encoded in a Unicode string first have to be converted to a sequence of glyphs, before they can be displayed. The shape of each glyph depends not only on the principal character that it represents, but also on the surrounding characters, e.g., the ``matras'' and conjuncts used in most Indian languages. Special libraries like Pango [17] have to be used for Indian scripts. While it would be best to improve the X font mechanism, that task is well outside the scope of this project.
Till recently, XFree86 did not even support TrueType fonts, and several Linux vendors had developed font servers like xfs built around the FreeType font engine [18]. While XFree86 versions from 4.0 (?) onwards have directly incorporated FreeType, Redhat 8.0 and higher versions still use xfs. The process of installing fonts under X differs slightly, depending on whether a font server is in use, or not. Another complication is introduced by the fact that most newer KDE and GNOME programs obtain fonts from a new standard called fontconfig (also going by the name of Xft). Thus, the best bet is to make consistent changes to all three configuration files: for the X server, for the xfs font server, and for fontconfig (Xft). First, we will cover steps common to all three categories, and then go to the specific for each. If you are using other font servers, e.g., xfstt, the font de-uglification HOWTO [15] can show you how to install fonts there.
To find out whether your system is using a font server, type,
ps -aux | grep xfsIf you are running the xfs font server, this will show the process. To date, Redhat runs xfs in all versions above 8.0.
As super-user, copy utkalm.ttf to /usr/X11R6/lib/X11/fonts/TTF/,
mkdir -p /usr/X11R6/lib/X11/fonts/TTF/ cp utkalm.ttf /usr/X11R6/lib/X11/fonts/TTF/Now, one has to make fonts.scale and fonts.dir, via,
ttmkfdir -o fonts.scale /usr/X11R6/bin/mkfontdirIn case of any problems, try instead ttmkfdir with the -m option, e.g., ttmkfdir -m 100, which will discard any bad characters from the font file. You can take a look at the files to verify that utkalm.ttf has been installed:
grep utkalm.ttf fonts.scale fonts.dirshould show something like:
fonts.scale:utkalm.ttf -misc-utkal-medium-r-normal--0-0-0-0-p-0-iso10646-1 fonts.dir:utkalm.ttf -misc-utkal-medium-r-normal--0-0-0-0-p-0-iso10646-1The zeroes indicate that it is a TrueType font, and the ``iso646'' means that it is Unicode-encoded.
locate XF86Configor, better yet, look at the X server log (typically, /var/log/XFree86.0.log) to see which configuration file is being used. In the XF86Config configuration file, look for lines with FontPath in the first column, and add
FontPath ``/usr/X11R6/lib/X11/fonts/TTF/''if such a line does not already exist. There will very likely be several other FontPath lines in the file. If, instead you see only a single line like
FontPath ``unix/:7100''you are using a font server, and there is no point in trying to to add fonts directly under X.
Restart the X server. On some systems, simply logging out and logging back in accomplishes this, or a menu item is offered from the login screen. (Ctrl-Alt-Backspace should also kill the X server, logging you out if you are logged in via xdm/kdm/gdm, and the display manager should automatically restart the X server.)
catalogue = /usr/X11R6/lib/X11/fonts/misc:unscaled,
/usr/X11R6/lib/X11/fonts/100dpi:unscaled,
/usr/X11R6/lib/X11/fonts/75dpi:unscaled,
/usr/X11R6/lib/X11/fonts/Type1,
/usr/X11R6/lib/X11/fonts/Speedo,
/usr/X11R6/lib/X11/fonts/misc,
/usr/X11R6/lib/X11/fonts/100dpi,
/usr/X11R6/lib/X11/fonts/75dpi,
/usr/X11R6/lib/X11/fonts/TTF/
The name of the directory needs to be added only if it does not already exist.
Now, reload xfs, with,
service xfs reloadWhile this should let you start using your newly-installed font, I have seen occasional problems where the new font is not immediately available. Hence, it is best to also restart the X server here, as described at the end of Sec. 3.2.2.
<dir>/usr/X11R6/lib/X11/fonts/TTF/</dir>Newer systems suggest that any local modifications should be put in /etc/fonts/local.conf, as /etc/fonts/fonts.conf is replaced when fontconfig is updated. If you do not have a /etc/fonts/local.conf, simply make the above change in /etc/fonts/fonts.conf. Force fontconfig to update its cache, with.
fc-cache -f
You should also consider uncommenting the section in /etc/fonts/local.conf that says ``Enable sub-pixel rendering'' so as to get better quality output. (The end of the comment line is marked by ``->'', so move that symbol from the end of the section to the end of the line starting ``Enable sub-pixel rendering.'')
Newer KDE versions have a GUI font installer that can be run from the KDE control centre. Log in as super-user, with KDE as the desktop. Start up the control centre from the main panel menu, and then choose System Administration -> Fonts. While this should automatically carry out the configuration steps mentioned above, I have not personally used the font installer and cannot vouch that it works. Unfortunately, GNOME does not yet have a built-in font installer.
/usr/X11R6/bin/xlsfonts | grep utkalFor the fontconfig system, you can similarly check with,
fc-list | grep utkalLikewise, the Oriya font should show up in the GNOME and KDE font selectors.
Two versions of a linear Unicode font have been made available to members of the Yahoo group Orissa-IT [22] by Mr. Avarangal. The exact licensing terms are not clear to me, but from a posting by the author it seems that one of the fonts (awa22.ttf, named aAwarangal. Note carefully the distinction in spelling from the other font, aAvarangal) is available free of charge.
In 2003, Andy White posted a message to the indlinux-oriya group on SourceForge, announcing the conversion of two Akruti Oriya fonts to OpenType [23]. These were released under the GPL, and to the best of my knowledge are still open-source and free of charge. These have the advantage that they include all the base Oriya characters, and seem to have most, if not all, conjuncts, and come in two weights (bold and normal). While Rajesh Pradhan had independently started to develop an OpenType Unicode font [24], he has since agreed to focus instead on the Andy White fonts. Most problems other than cosmetic ones have been fixed, and this font is now being distributed [25] as the utkalm.ttf mentioned above. For backwards compatibility with non-Unicode-aware software, we will either use the CDAC Sarala fonts, or develop our own TrueType version of it.
FontForge can be installed in a straightforward manner, as per the installation instructions in the documentation [3]. External libraries used by FontForge [30] should be installed first. Of these, libpng, zlib, libtiff, libungif, libjpeg, and libxml2, were already available from the Redhat 8.0 CDs. libuninameslist was compiled and installed as per the instructions on the homepage [31]. Also, for improved display of fonts, FontForge needs the source code from the FreeType font engine. This is typically not included on Linux distribution CDs, and the source code for the version corresponding to the one installed on your system must be downloaded from the FreeType homepage [18]. One can check what libraries are currently installed, e.g., with,
rpm -q -a | grep libpngor,
locate libpngMost GNU software, including libuninameslist and FontForge installs with the same configure/make/make install cycle, i.e., download, uncompress and untar the source code, change directory to the one holding the source code, and then, as super-user, type:
./configure make make installCompilation options can be listed by
./configure --helpwhich in some cases might allow one to tune the options to one's specific system.
The FontForge documentation is also available for download [32]. If installed with,
mkdir -p /usr/local/share/doc/fontforge cd /usr/local/share/doc/fontforge gunzip fontforge_htdocs-*.tgz tar xf fontforge_htdocs-*.tar rm fontforge_htdocs-*.tar
cp or_IN /usr/share/i18n/locales gzip -d -c /usr/share/i18n/charmaps/UTF-8.gz > /tmp/UTF-8 localedef -f /tmp/UTF-8 -i /usr/share/i18n/locales/or_IN /usr/lib/locale/or_IN
... en_US.UTF-8/Compose oc_FR.UTF-8 en_US.UTF-8/Compose or_IN.UTF-8 en_US.UTF-8/Compose pd_DE.UTF-8 ... en_US.UTF-8/Compose: oc_FR.UTF-8 en_US.UTF-8/Compose: or_IN.UTF-8 en_US.UTF-8/Compose: pd_DE.UTF-8 ...locale.alias
... oc_FR@euro oc_FR.ISO8859-15 or or_IN or_IN or_IN.UTF-8 pd pd_US.ISO8859-1 ... or: or_IN.ISO8859-1 or_IN: or_IN.ISO8859-1 ...locale.dir
... en_US.UTF-8/XLC_LOCALE oc_FR.UTF-8 en_US.UTF-8/XLC_LOCALE or_IN.UTF-8 en_US.UTF-8/XLC_LOCALE pd_DE.UTF-8 ... en_US.UTF-8/XLC_LOCALE: or_IN.ISO8859-1 ...Restart your X server in order for the changes to take effect; the simplest way being to log off and log back in.
It is possible that the files on your system have different entries from the ones listed above. So, the best strategy is to copy all lines that have ``oc'' or ``oc_FR'' (but not oc_FR@euro'') in them into the same file, and to replace ``oc'' with ``or,'' or ``oc_FR'' with ``or_IN.''
rpm -Uvh locales-in-1.0-1.i586.rpm rpm -Uvh locales-or-1.0-1.i586.rpmThis will install locales for both glibc and X. You can now similarly install locales for other languages from the same site. However, please note that we are planning to standardize on the Rajesh Pradhan Oriya locale, and have not as yet investigated the differences between this and the IIT-Kanpur Oriya locale.
First, check the default locale with,
echo $LANGThis will typically be en_US, or some other variant of English. You will need to remember this value to reset your default locale at the end. Set the locale to Oriya with,
export LANG=or_INassuming that bash (the default shell under Redhat) or some Bourne shell derivative is being used. For tcsh and csh-derivatives, use instead,
setenv LANG or_INand similarly modify the instructions below.
Now, typing date should give you the date in Oriya. On a normal, non-Unicode terminal, this will show up as some garbage with English numerals. Save the output to a file and examine the contents with yudit or gedit (see Sec. 5.2) to see the date properly formatted in Oriya. For example,
date > junk gedit junkIf you get any error messages or warnings about unsupported locales, or if the date does not show up properly in Oriya, your locale and/or font is not properly installed. For resuming normal work, do not forget to reset to the default locale, e.g., with,
export LANG=en_USReplace en_US with whatever the default locale was determined to be at the beginning.
gnome-terminal can be put into Unicode mode by running the command unicode_start, or by selecting Unicode mode from the menubar, Terminal -> Character Coding -> Unicode (UTF-8). Once the terminal is in Unicode mode,
export LANG=or_IN dateshould show the date in Oriya directly in the terminal, without a need for the intermediate step of saving the output to a file, as in Sec. 4.4. To switch back to the default encoding, use either Terminal -> Character Coding -> Current Locale, or run the command unicode_stop. unicode_start and unicode_stop should work for any xterm-compatible terminal emulator, i.e., almost all of them, but I have not tried this in other terminals.
tar xzf yudit-2.7.6.tar.gz patch -p0 < yudit-2.7.6.patch1.txt cd yudit-2.7.6 ./configure make make installwill install yudit in /usr. yudit 2.7.6 is also included in some of the newer Linux distributions. When you run yudit for the first time, it creates a configuration file, yudit.properties in your home directory, under the hidden directory, .yudit.
As yudit uses its own font-handling and rendering engine, some additional setup work is needed. Firstly, one has to make the Oriya font available to yudit. As super-user, do
ln -s /usr/X11R6/lib/X11/fonts/TTF/utkalm.ttf /usr/share/yudit/fontsassuming that the font you want to use is in the file utkalm.ttf in the directory /usr/X11R6/lib/X11/fonts/TTF. The above command creates a symbolic link (shortcut) to the TTF font file, and you can similarly link in any other TrueType font files that you want yudit to be able to use. Else, add the directory /usr/X11R6/lib/X11/fonts/TTF to the property yudit.fontpath in the yudit configuration file /.yudit/yudit.properties, which should this have a line something like,
yudit.fontpath=/usr/share/yudit/fonts,/usr/X11R6/lib/X11/fonts/TTFIn this case, it is not necessary to make the above symbolic link.
Search for the line starting with ``yudit.font.TrueType='' in /.yudit/yudit.properties, and append the name of the font file, utkalm.ttf. Thus, my /.yudit/yudit.properties has the line
yudit.font.TrueType=yudit.ttf,utkalm.ttfThe line may include any number of TrueType font file names. Restart yudit to be able to use the newly added Oriya font.
When you start up yudit, make sure that the Font tab (default location is third from the right in the toolbar at the top) says TrueType. You can change the tab setting by clicking the left mouse button in the tab. Click on the Input tab (default toolbar position second from right) to set up for Oriya input. This brings up a pop-up dialog window that allows one to select various keyboard input methods. For Oriya, click on Oriya-Inscript in the leftmost pane. You can assign this to a hot key by next clicking on F2 (seond line from top) in the middle pane, and then clicking on the small blue arrow in between the left and middle panes. Click on OK to exit the dialog, and your Input tab should now be labelled ``Oriya-Inscript.'' From now on, you can use the F2 key to switch to keyboard input in Oriya using the Inscript layout. By default, the F1 key brings you back to the normal (English) keyboard layout. If you are used to the ITRANS keyboard layout for typing in Oriya, you can similarly assign a hot key to the ``Oriya'' keymap via the dialog brought up by clicking on the Input tab. See Sec. 6.1 for more on yudit keymaps.
If all has gone well, you should now be able to type in Oriya at the keyboard, and see Oriya text appearing in the yudit window. yudit has many more useful features, such as the ability to change display font sizes by clicking on the Bigger and Smaller tabs in the toolbar, represented by the magnifier/demagnifier icons. Some yudit documentation is available under /usr/share/yudit/doc.
The vim editor, which adds various enhancements to the classic vi editor, is able to use Unicode when started from a terminal emulator where Unicode has been enabled.
Before a .kmap layout can be used by yudit, it has to be converted to a binary .my format, using the mytool program that is installed along with yudit. Thus, after copying and modifiying Oriya-Inscript.kmap, an individual user could run
mytool -type kmap -kmap Oriya-Inscript.kmap -rkmap Oriya-Inscript.kmap
-write ~/.yudit/data/Oriya-Inscript.my
which would write /.yudit/data/Oriya-Inscript.my in the user's home
directory. To make it available system-wide, copy
/.yudit/data/Oriya-Inscript.my to /usr/share/yudit/data as super-user,
replacing the old Oriya-Inscript.my.
I have tried to take a peek at what other keyboard input methods have been developed by various groups. I tried installing LISM [42] but was unsuccessful, even with help from the CDAC-GIST support group. I was more successful in using the software distributed by the Computer Science and Engineering department of IIT-Kanpur. Their Linux technology development project for Indian languages [43] offers a wide variety of software. Unfortunately, I have not yet had time to investigate these, apart from the locales mentioned in Sec. 4.3. Besides these, there are several other efforts to support Indian languages that would bear investigation.
An Oriya Inscript keymap from G. Karunakar is installed with PCQLinux 2004. We have combined this with another xkb configuration from D. Holl to form an enhanced Oriya Inscript map, oriya_inscript.xkb [47]. Instructions for installing this map are also included in the comments at the beginning of this file. You will need to have XFree86 version 4.3.0 or higher for this keymap to work. (You can check the XFree86 version number at the top of the log file, usually /var/log/XFree86.0.log.)
Uncompress the file, ori_inscript.gz,1 and copy it to /etc/X11/xkb/symbols/pc. Thus, as super-user, do
gzip -d ori_inscript.gz cp ori_inscript /etc/X11/xkb/symbols/pc/ori_inscriptYou can manually install the keymap, but this will have to be done each time that you log in to X. After copying the xkb keymap file, as the user logged into X, type
setxkbmap -rules xfree86 -model pc104 -layout "us,ori_inscript"
-option "grp:alt_shift_toggle" -option "lv3:switch"
This installs two keymaps: the standard ``us'' one, and the ``ori_inscript''
keymap above, and one can toggle between the two by pressing the Alt and Shift
keys simultaneously. The ``pc104'' argument describes the model of my
keyboard, which is quite commonly used. You can find the exact model of your
particular keyboard by looking for a line containing ``XkbModel'' in the
XFree86 configuration file, usually /etc/X11/XF86Config, and in any case the
normal layouts are similar for most keyboards. The final ``-option
lv3:switch'' allows you to use the right-hand Control key to switch to the
third and fourth levels of the keyboard layouts; the first level being the
normal (unshifted) layout, and the second one being accessed with the Shift
key. While the ori_inscript map does define useful values for the
higher levels, we leave discussion of these to a later version of this primer.
You can edit your XFree86 configuration file to automatically install the Oriya keymap each time that a user logs in. To do so, find the part of the file dealing with the keyboard, which should look something like:
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us"
...
EndSection
Make sure that ``xfree86'' is the option on the ``XkbRules'' line. The option
for ``XkbModel'' might be different for your keyboard: leave it unchanged.
Modify the ``XkbLayout'' line, and add other options so that the final entry
looks something like:
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc104"
Option "XkbLayout" "us,ori_inscript"
Option "XkbOptions" "grp:alt_shift_toggle"
Option "XkbOptions" "lv3:switch"
...
EndSection
Save the file and restart X in order for the changes to take effect. A word of
caution for the unwary: in the middle of happily typing away in Oriya, it is
easy to forget that the keyboard layout has been switched. So, if you are
typing in a non-Unicode application and are getting no output or some garbage,
press Alt+Shift to toggle the keyboard layout back to normal. See the next
section for a more easily visible way to toggle keyboard layouts under
GNOME and KDE.
xkb only allows a one-to-one mapping of input and output keys, so that
the pre-formed conjuncts in the Inscript layout cannot be made available
here. People are working on a project called the Internet/Intranet Input
Method Framework (IIIMF) [48] which is a next-generation
multingual Unicode input framework. It is also intended to be independent of
operating platform and windowing system. I am in the process of investigating
this.
For GNOME, you can add the keyboard switching applet to the panel by right-clicking on a blank area of the panel, and then choosing Add to Panel -> Utility -> Keyboard Layout Switcher. Bring up the preferences dialog by right-clicking on the applet and choosing Preferences. Typically, only the default keyboard will be shown the first time. Click on the Add button at the top right, select Oriya -> India -> Oriya xkb keymap, and click Add followed by Close to add the Oriya Inscript keymap. By default, this uses the layout in /etc/X11/xkb/symbols/pc/ori, i.e., the old Karunakar layout. So, in order to use the ori_inscript xkb map, highlight the Oriya xkb map entry, and click Properties to modify it. This brings up a dialog window in which you should replace `setxkbmap ori' with `setxkbmap ori_inscript -option "lv3:switch"' for the Command string. Close all dialog windows. Now, you can switch through all keymaps added to the Keyboard Layout Switcher by clicking on the applet, or by pressing Alt+Shift. The current keyboard layout is indicated by the flag and/or label used by the applet. While this makes it convenient to enter multi-lingual text, it is possible to get confused if there are a large number of keyboards added to the switcher.
KDE has a similar application, the KDE keyboard tool. This might already be in your system tray, and would show up as a small square labelled, e.g., ``us.'' Right-click on the icon, and choose Configure to install the Oriya keymap. Else, it can be accessed by starting the KDE control center (KDE menu -> Settings -> Control Center), and choosing Regional & Accessibility -> Keyboard Layout from within it in order to configure the keyboard tool. The Layout tab shows two panes, the left-hand one with the available layouts and the right-hand pane for the active layouts. Layouts can be activated by highlighting available ones and clicking on Add. Selecting one of the active keymaps displays the command used to install it at the bottom of the configuration dialog. Replace the default command for the Oriya layout, `setxkbmap -model pc104 -layout ori -variant basic' with `setxkbmap -model pc104 -layout ori_inscript -option "lv3:switch"' to use our modified Oriya Inscript keymap that was copied to /etc/X11/xkb/symbols/pc/ori_inscript. Note that you have to click on the icon in the system tray to switch between layouts, as Alt+Shift does not seem to switch layouts, at least in my version of KDE.
Multilingual programs under Linux generally use the GNU gettext system which provides a set of tools for both the programmer and the translator. The two of them can work independently of each other, and the particular message output by the program will depend on the locale (see Sec. 4) that is in effect at the time the program is run. Instead of directly using C library routines for output, the program uses a gettext wrapper, viz., instead of,
#include <stdio.h>
int main(void) {
printf( ``Hello world!\n'' );
return 0;
}
she would write:
#include <stdio.h>
#include <libintl.h>
int main(void) {
setlocale( LC_ALL, "" );
textdomain( ``hello-world'' );
printf( gettext( ``Hello, world!\n'' ) );
return 0;
}
The modicum of extra typing here can be further simplified by the use of a CPP
macro to replace the string ``gettext'' in the program source code. The
strings needing translation can then be extracted from the source code by
xgettext leading to an editable .pot (portable object template) file. At
this point, no translations have yet been made, and the template file is not
yet oriented towards any particular language.
The translator, working independently of the programmer, can then add translated messages using the .pot template to create a LANG.po file, specific to a particular language. This task is simplified somewhat by using PO mode in emacs.
A portable object file must be compiled into a .mo (machine object) file with the msgfmt program before it can be used. Finally, the .mo file is copied to a standard location, usually /usr/share/locale/LL/LC_MESSAGES or /usr/share/locale/LL_CC/LC_MESSAGES, where LL stands for a language, and CC for a country, e.g., for Oriya, the location might be /usr/share/locale/or_IN/LC_MESSAGES. The translated message is picked from the appropriate message catalogue depending on the locale that is in effect at the time of running the program. E.g., if the locale is set to es, the messages would be taken from the program's .mo file in /usr/share/locale/es/LC_MESSAGES, and if it is set instead to or_IN, the .mo file in /usr/share/locale/or_IN/LC_MESSAGES would be used.
While this is the basic scheme, further complications are introduced by the need to update the internationalized messages as the program source is modified. The gettext manual provides a complete description of the process of internationalization and translation, and is available, e.g., in emacs info-mode (accessed by typing Control-h i in emacs). A more extensive introduction to the work of translation using gettext is also available [50].
This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.70)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -no_math -html_version 4.0,math,unicode,i18n,tables -mkdir -dir memo -split 0 memo
The translation was initiated by Gora Mohanty on 2004-07-24