[ < ] [ > ]   [Contents] [Index] [ ? ]

2.48 The `trunk/Locales' Directory

The `trunk/Locales' directory exists to store the translation messages used to produce content in different languages.

Translation messages are organized using the directory structure of the component being translated. For example, if we want to provide translation messages for `trunk/Manuals/Repository', then the `trunk/Locales/Manuals/Repository' directory needs to be created.

Once the locale directory exists for the component we want to provide translation messages for, it is necessary to create the translation files where translation messages are. The translation files follows the concepts of xml2po and GNU gettext tools.

The basic translation process is as follow: first, translatable strings are extracted from files and a portable object template (.pot) is created or updated with the information. Using the portable object template, a portable object (.po) is created or updated for translator to locale the messages retrived. Finally, a machine object (.mo) is created from portable object to sotore the translated messages.

Inside the repository there are two ways to retrive translatable strings from files. The first one is through xml2po command and the second through xgettext command. The xml2po is used to retrive translatable strings from XML files (e.g., Scalable Vector Graphics, DocBook, etc.) and the xgettext command is used to retrive translatable strings from shell scripts files (e.g., the files that make the centos-art.sh command-line interface).

When translatable strings are retrived from XML files, using the xml2po command, there is no need to create the machine object as we do when translatable strings ar retrived from shell files, using the xgettext command. The xml2po produces a temporal machine object in order to create a translated XML file. Once the translated XML file has been created the machine object is no longer needed. On the other hand, the machine object produced by the xgettext command is required by the system in order for the show shell script localized messages.

Another difference between xml2po and xgettext we need to be aware of is the directory structure used to store machine objects. In xml2po, the machine object is created in the current working directory as `.xml2po.mo' and can be safetly removed once the translated XML file has been created. In the case of xgettext, the machine object needs to be stored in the `$TEXTDOMAIN/$LOCALE/LL_MESSAGES/$TEXTDOMAIN.mo' file in order for the system to interpret it and should not be removed since it is the file that contain the translation messages themselves.

Automation of localization tasks is achived through the locale functionality of command-line interface.

[Contents] [Index] [ ? ]

This document was generated on March, 30 2011 using texi2html 1.76.