Blob Blame History Raw
<?xml version="1.0"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

    <title>CentOS Artwork Repository: 2.48 The trunk/Locales Directory</title>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="description" content="CentOS Artwork Repository: 2.48 The trunk/Locales Directory" />
    <meta name="keywords" content="CentOS Artwork Repository: 2.48 The trunk/Locales Directory" />
    <meta name="resource-type" content="document" />
    <meta name="distribution" content="global" />
    <meta name="generator" content="texi2html 1.76" />
    <meta name="copyright" content="2009-2011 Alain Reguera Delgado" />

    <link href="/home/centos/artwork/trunk/Identity/Manual/repository.css" rel="stylesheet" type="text/css" media="screen projection" />

</head>

<body>

<a name="top" />

<div id="wrap">

    <div id="page-body">

        <div id="content">

<!-- Created on March, 30 2011 by texi2html 1.76 -->
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="repository_54.xhtml#SEC268" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_56.xhtml#SEC270" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Next chapter"> &gt;&gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository.xhtml#SEC_Top" title="Cover (top) of document">Top</a>]</td>
<td valign="middle" align="left">[<a href="repository_toc.xhtml#SEC_Contents" title="Table of contents">Contents</a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Index">Index</a>]</td>
<td valign="middle" align="left">[<a href="repository_abt.xhtml#SEC_About" title="About (help)"> ? </a>]</td>
</tr></table>
<a name="Directories-trunk-Locales"></a>
<a name="SEC269"></a>
<h2 class="section"> 2.48 The <tt>`trunk/Locales'</tt> Directory </h2>

<p>The <tt>`trunk/Locales'</tt> directory exists to store the translation
messages used to produce content in different languages.
</p>
<p>Translation messages are organized using the directory structure of
the component being translated. For example, if we want to provide
translation messages for <tt>`trunk/Manuals/Repository'</tt>, then the
<tt>`trunk/Locales/Manuals/Repository'</tt> directory needs to be created.
</p>
<p>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 <code>xml2po</code> and GNU <code>gettext</code> tools.
</p>
<p>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.
</p>
<p>Inside the repository there are two ways to retrive translatable
strings from files. The first one is through <code>xml2po</code> command
and the second through <code>xgettext</code> command. The <code>xml2po</code>
is used to retrive translatable strings from XML files (e.g., Scalable
Vector Graphics, DocBook, etc.) and the <code>xgettext</code> command is
used to retrive translatable strings from shell scripts files (e.g.,
the files that make the <code>centos-art.sh</code> command-line
interface).
</p>
<p>When translatable strings are retrived from XML files, using the
<code>xml2po</code> command, there is no need to create the machine
object as we do when translatable strings ar retrived from shell
files, using the <code>xgettext</code> command. The <code>xml2po</code>
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 <code>xgettext</code> command is required by the system in order for
the show shell script localized messages.
</p>
<p>Another difference between <code>xml2po</code> and <code>xgettext</code> we
need to be aware of is the directory structure used to store machine
objects. In <code>xml2po</code>, the machine object is created in the
current working directory as <tt>`.xml2po.mo'</tt> and can be safetly
removed once the translated XML file has been created. In the case of
<code>xgettext</code>, the machine object needs to be stored in the
<tt>`$TEXTDOMAIN/$LOCALE/LL_MESSAGES/$TEXTDOMAIN.mo'</tt> 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.
</p>
<p>Automation of localization tasks is achived through the <code>locale</code>
functionality of command-line interface.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top"><a href="repository_72.xhtml#SEC357">2.65 The <tt>`trunk/Scripts/Functions/Locale'</tt> Directory</a></td><td>&nbsp;&nbsp;</td><td align="left" valign="top">
</td></tr>
</table>


<div class="page-line white"><hr style="display:none;" /></div>
<table cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">[<a href="repository_54.xhtml#SEC268" title="Previous section in reading order"> &lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_56.xhtml#SEC270" title="Next section in reading order"> &gt; </a>]</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Beginning of this chapter or previous chapter"> &lt;&lt; </a>]</td>
<td valign="middle" align="left">[<a href="repository_7.xhtml#SEC12" title="Up section"> Up </a>]</td>
<td valign="middle" align="left">[<a href="repository_80.xhtml#SEC416" title="Next chapter"> &gt;&gt; </a>]</td>
</tr></table>

            <div class="page-line"><hr style="display:none;" /></div>

        </div>

    </div>

    <div class="page-line white"><hr style="display:none;" /></div>

</div>

</body>

</html>