12.07.2015 Views

free openSS

free openSS

free openSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Annex B. Localization – Technical Aspects ❘ 43# localedef -f TIS-620 -i th_TH th_THThe charmap file may be installed at /usr/share/i18n/charmaps directory, and the locale definition file at/usr/share/i18n/locales directory, for further reference.The locale command can be used with “-a” option to check for all installed locales and “-m” option to listsupported charmaps. Issuing the command without argument shows the locale categories selected byenvironment setting.TranslationThe translation framework most commonly used in FOSS is GNU gettext, although some cross-platformFOSS, such as AbiWord, Mozilla and OpenOffice.org use their own frameworks as a result of the crossplatformabstractions. In this section, the GNU gettext, which covers more than 90 percent of GNU/Linuxdesktops, is discussed briefly. The concepts discussed here, however, apply to other frameworks.Messages in program source code are put in a short macro that calls a gettext function to retrieve thetranslated version. At program initialization, the hashed message database corresponding toLC_MESSAGES locale category is loaded. Then, all messages covered by the macros are translated byquick lookup during program execution. Therefore, the task of translation is to build the messagetranslation database for a particular language and get it installed in an appropriate place for the locale.With that preparation, the gettext programs are automatically translated as per locale setting withouthaving to touch the source code.GNU gettext also provides tools for creating the message database. Two kinds of files are involved in theprocess:PO (Portability Object) file. This is a file in human-readable form for the translators to work with.It is named so because of its plain-text nature, which makes it portable to other platforms.MO (Machine Object) file. This is a hashed database for machines to read. It is in the final formatto be loaded by the gettext program. There are many translation frameworks in commercialUnices, and these MO files are not compatible. One may also find some GMO files as immediateoutput from GNU gettext tools. They are MO files containing some GNU gettext enhancedfeatures.Important GNU gettext tools will be discussed by describing the summarized steps of translation fromscratch (See Figure 3):1. Extract messages with the xgettext utility. What you get is the “package.pot” file as a templatefor the PO file.Figure 3GNU gettext Working Process

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!