|
|
2b1657 |
<refentry id="scripts-bash-locale">
|
|
|
655c5e |
|
|
|
2b1657 |
<refmeta>
|
|
|
2b1657 |
<refentrytitle>locale</refentrytitle>
|
|
|
2b1657 |
<indexterm type="specific-function">
|
|
|
2b1657 |
<primary>Standardize translation tasks inside &TCAR;</primary>
|
|
|
2b1657 |
</indexterm>
|
|
|
2b1657 |
</refmeta>
|
|
|
655c5e |
|
|
|
2b1657 |
<refnamediv>
|
|
|
2b1657 |
<refname>locale</refname>
|
|
|
2b1657 |
<refpurpose>Standardize translation tasks inside &TCAR;</refpurpose>
|
|
|
2b1657 |
</refnamediv>
|
|
|
655c5e |
|
|
|
2b1657 |
<refsynopsisdiv>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
The <varname>DIRECTORY</varname> parameter specifies the
|
|
|
655c5e |
directory path, inside the working copy of &TCAR;, where the
|
|
|
655c5e |
files you want to process are stored in. This paramter can be
|
|
|
655c5e |
provided more than once in order to process more than one
|
|
|
655c5e |
directory path in a single command execution. When this
|
|
|
655c5e |
parameter is not provided, the current directory path where
|
|
|
655c5e |
the command was called from is used instead.
|
|
|
655c5e |
</para>
|
|
|
2b1657 |
</refsynopsisdiv>
|
|
|
ad6d4b |
|
|
|
2b1657 |
<refsection id="scripts-bash-locale-options">
|
|
|
ad6d4b |
<title>Options</title>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
The <function>locale</function> functionality accepts the
|
|
|
655c5e |
following options:
|
|
|
655c5e |
</para>
|
|
|
655c5e |
|
|
|
655c5e |
<variablelist>
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--quiet</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Supress all output messages except error messages. When this
|
|
|
655c5e |
option is passed, all confirmation requests are supressed and
|
|
|
655c5e |
a possitive answer is assumed for them, just as if the
|
|
|
655c5e |
<option>--answer-yes</option> option would have been provided.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--answer-yes</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Assume <emphasis>yes</emphasis> to all confirmation requests.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--filter="REGEX"</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Reduce the list of files to process inside
|
|
|
655c5e |
<varname>DIRECTORY</varname> using <varname>REGEX</varname> as
|
|
|
655c5e |
pattern. You can use this option to control the amount of
|
|
|
655c5e |
files you want to locale. The deeper you go into the
|
|
|
655c5e |
directory structure the more specific you'll be about the
|
|
|
655c5e |
files you want to locale. When you cannot go deeper into the
|
|
|
655c5e |
directory structure through <varname>DIRECTORY</varname>
|
|
|
655c5e |
specification, use this option to reduce the list of files
|
|
|
655c5e |
therein.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
3b9515 |
<term><option>--synchronize</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
8e7bd5 |
Synchronizes available changes between the working copy and
|
|
|
8e7bd5 |
the central repository.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--update</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
This option updates both POT and PO files related to source
|
|
|
655c5e |
files. Use this option everytime you change translatable
|
|
|
655c5e |
strings inside the source files.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--edit</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
This option edits the portable object related to source files.
|
|
|
655c5e |
When you provide this option, your default text editor is used
|
|
|
655c5e |
to open the portable object you, as translator, need to change
|
|
|
655c5e |
in order to keep source file messages consistent with their
|
|
|
655c5e |
localized versions. In the very specific case of shell
|
|
|
655c5e |
scripts localization, this option takes care of updating the
|
|
|
655c5e |
machine object (MO) file the shell script requires to
|
|
|
655c5e |
displayed translation messages correctly when it is executed.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--delete</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
This option unlocalizes source files. When you provide this
|
|
|
655c5e |
option, the localization directory related to source files is
|
|
|
655c5e |
removed from the working copy in conjunction with all portable
|
|
|
655c5e |
objects and machine objects inside it.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
<varlistentry>
|
|
|
655c5e |
<term><option>--dont-create-mo</option></term>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
This option suppresses machine objects creation when shell
|
|
|
655c5e |
scripts are localized.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</varlistentry>
|
|
|
655c5e |
|
|
|
655c5e |
</variablelist>
|
|
|
2b1657 |
</refsection>
|
|
|
ad6d4b |
|
|
|
2b1657 |
<refsection id="scripts-bash-locale-description">
|
|
|
ad6d4b |
<title>Description</title>
|
|
|
655c5e |
|
|
|
655c5e |
<para>
|
|
|
655c5e |
The localization process is very tied to the source files we
|
|
|
655c5e |
want to provide localized messages for. Inside the working
|
|
|
655c5e |
copy of &TCAR; it is possible to localize XML-based files
|
|
|
655c5e |
(e.g., SVG and Docbook) and programs written in most popular
|
|
|
655c5e |
programming languages (e.g., C, C++, C#, Shell Scripts,
|
|
|
655c5e |
Python, Java, GNU awk, PHP, etc.).
|
|
|
655c5e |
</para>
|
|
|
655c5e |
|
|
|
655c5e |
<para>
|
|
|
655c5e |
The localization process initiates by retriving translatable
|
|
|
655c5e |
strings from source files. When source files are XML-based
|
|
|
655c5e |
files, the only requisite to retrive translatable strings
|
|
|
655c5e |
correctly is that they be well-formed. Beyond that, the
|
|
|
655c5e |
<command>xml2po</command> command takes care of everything
|
|
|
655c5e |
else. When source files are Shell script files, it is
|
|
|
655c5e |
necessary that you previously define what strings inside the
|
|
|
655c5e |
script are considered as translatable strings in order for
|
|
|
655c5e |
<command>xgettext</command> command to retrive them correctly.
|
|
|
655c5e |
To define translatable strings inside shell scripts, you need
|
|
|
655c5e |
to use either <command>gettext</command>,
|
|
|
655c5e |
<command>ngettext</command>, <command>eval_gettext</command>
|
|
|
655c5e |
or <command>eval_ngettext</command> command as it is following
|
|
|
655c5e |
described:
|
|
|
655c5e |
</para>
|
|
|
655c5e |
|
|
|
655c5e |
<itemizedlist>
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Use the <command>gettext</command> command to display the
|
|
|
655c5e |
native language translation of a textual message.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
<screen>MESSAGE="`gettext "There is no entry to create."`"</screen>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Use the <command>ngettext</command> command to display the
|
|
|
655c5e |
native language translation of a textual message whose
|
|
|
655c5e |
grammatical form depends on a number.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
<screen>MESSAGE="`ngettext "The following entry will be created" \
|
|
|
655c5e |
"The following entries will be created" \
|
|
|
655c5e |
$COUNT`:"</screen>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Use the <command>eval_gettext</command> command to display the
|
|
|
655c5e |
native language translation of a textual message, performing
|
|
|
655c5e |
dollar-substitution on the result. Note that only shell
|
|
|
655c5e |
variables mentioned in the message will be dollar-substituted
|
|
|
655c5e |
in the result.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
<screen>MESSAGE="`eval_gettext "The location \\\"\\\$LOCATION\\\" is not valid."`"</screen>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
|
|
|
655c5e |
<listitem>
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Use the <command>eval_ngettext</command> command to display
|
|
|
655c5e |
the native language translation of a textual message whose
|
|
|
655c5e |
grammatical form depends on a number, performing
|
|
|
655c5e |
dollar-substitution on the result. Note that only shell
|
|
|
655c5e |
variables mentioned in messages will be dollar-substituted in
|
|
|
655c5e |
the result.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
<screen>MESSAGE="`eval_ngettext "The following entry will be created in \\\$LOCATION" \
|
|
|
655c5e |
"The following entries will be created in \\\$LOCATION" \
|
|
|
655c5e |
$COUNT`:"</screen>
|
|
|
655c5e |
</listitem>
|
|
|
655c5e |
</itemizedlist>
|
|
|
655c5e |
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Once translatable strings are retrived, a portable object
|
|
|
655c5e |
template (POT) file is created for storing them. Later, the
|
|
|
655c5e |
POT file is used to create a portable object (PO). The
|
|
|
655c5e |
portable object is the place where localization itself takes
|
|
|
655c5e |
place, it is the file translators edit to localize messages.
|
|
|
655c5e |
When translatable strings change inside source files, it is
|
|
|
655c5e |
necessary that you update these POT and PO files in order to
|
|
|
655c5e |
keep consistency between source file messages and their
|
|
|
655c5e |
localized versions.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
|
|
|
655c5e |
<para>
|
|
|
655c5e |
Inside source files, translatable strings are always written
|
|
|
655c5e |
in English language. In order to localize translatable strings
|
|
|
655c5e |
from English language to another language, you need to be sure
|
|
|
655c5e |
the <envar>LANG</envar> environment variable has been already
|
|
|
655c5e |
set to the locale code you want to localize message for or see
|
|
|
655c5e |
them printed out before running the
|
|
|
655c5e |
<function>locale</function> functionality of
|
|
|
655c5e |
<command>centos-art.sh</command> script. Localizing English
|
|
|
655c5e |
language to itself is not supported.
|
|
|
655c5e |
</para>
|
|
|
655c5e |
|
|
|
655c5e |
<para>
|
|
|
655c5e |
To have a list of all locale codes you can have localized
|
|
|
655c5e |
messages for, run the following command: <command>locale -a |
|
|
|
655c5e |
less</command>.
|
|
|
655c5e |
</para>
|
|
|
2b1657 |
</refsection>
|
|
|
ad6d4b |
|
|
|
2b1657 |
<refsection id="scripts-bash-locale-environment">
|
|
|
b49d6b |
<title>Function Specific Environment</title>
|
|
|
ad6d4b |
<para>
|
|
|
ad6d4b |
...
|
|
|
ad6d4b |
</para>
|
|
|
2b1657 |
</refsection>
|
|
|
ad6d4b |
|
|
|
2b1657 |
<refsection id="scripts-bash-locale-authors">
|
|
|
ad6d4b |
<title>Authors</title>
|
|
|
ad6d4b |
<para>
|
|
|
ad6d4b |
The following people have worked in the
|
|
|
ad6d4b |
<function>locale</function> functionality:
|
|
|
ad6d4b |
</para>
|
|
|
ad6d4b |
<itemizedlist>
|
|
|
ad6d4b |
<listitem>
|
|
|
ad6d4b |
<para>
|
|
|
b49d6b |
Alain Reguera Delgado <<ulink url="mailto:alain.reguera@gmail.com">alain.reguera@gmail.com</ulink>>, =COPYRIGHT_YEAR_LIST=
|
|
|
ad6d4b |
</para>
|
|
|
ad6d4b |
</listitem>
|
|
|
ad6d4b |
</itemizedlist>
|
|
|
2b1657 |
</refsection>
|
|
|
ad6d4b |
|
|
|
2b1657 |
<refsection id="scripts-bash-locale-licence">
|
|
|
ad6d4b |
<title>License</title>
|
|
|
b49d6b |
|
|
|
ad6d4b |
<para>
|
|
|
b49d6b |
Copyright © =COPYRIGHT_YEAR_LIST= The CentOS Project
|
|
|
b49d6b |
</para>
|
|
|
ad6d4b |
|
|
|
b49d6b |
<para>
|
|
|
b49d6b |
This program is free software; you can redistribute it and/or
|
|
|
b49d6b |
modify it under the terms of the GNU General Public License as
|
|
|
b49d6b |
published by the Free Software Foundation; either version 2 of
|
|
|
b49d6b |
the License, or (at your option) any later version.
|
|
|
b49d6b |
</para>
|
|
|
ad6d4b |
|
|
|
b49d6b |
<para>
|
|
|
b49d6b |
This program is distributed in the hope that it will be
|
|
|
b49d6b |
useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
b49d6b |
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
b49d6b |
PURPOSE. See the GNU General Public License for more details.
|
|
|
b49d6b |
</para>
|
|
|
ad6d4b |
|
|
|
b49d6b |
<para>
|
|
|
b49d6b |
You should have received a copy of the GNU General Public
|
|
|
b49d6b |
License along with this program; if not, write to the Free
|
|
|
b49d6b |
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
|
|
|
b49d6b |
USA.
|
|
|
ad6d4b |
</para>
|
|
|
2b1657 |
</refsection>
|
|
|
655c5e |
|
|
|
2b1657 |
</refentry>
|