Blame Manual/Directories/trunk/Scripts/Functions/Locale.texi

df8e8d
@subheading Name
9c6e0d
df8e8d
The @strong{@code{locale}} functionlity is part of
df8e8d
@command{centos-art.sh} script and standardizes localization tasks
df8e8d
inside the working copy of CentOS Artwork Repository.
9c6e0d
df8e8d
@subheading Synopsis
9c6e0d
df8e8d
@command{centos-art} @code{@strong{locale}} @code{[OPTIONS] path/to/dir}
9c6e0d
df8e8d
The @file{path/to/dir} parameter specifies what directory structure
df8e8d
inside the working copy of CentOS Artwork Repository you want to
df8e8d
create translation messages for.
9c6e0d
df8e8d
The @strong{@code{locale}} functionality of @command{centos-art.sh} script
df8e8d
accepts the following options:
df8e8d
df8e8d
@table @option
df8e8d
@item --quiet
df8e8d
df8e8d
Supress all output messages except error messages.  When this option
df8e8d
is passed, all confirmation requests are supressed as well and a
df8e8d
possitive answer is assumed for them, just as if the
df8e8d
@option{--answer-yes} option had been provided.
df8e8d
df8e8d
@item --answer-yes
df8e8d
df8e8d
Assume `yes' to all confirmation requests.
df8e8d
df8e8d
@item --filter="REGEX"
df8e8d
df8e8d
Reduce the list of files to process using @samp{REGEX} as pattern.
df8e8d
You can use this option in combination with @file{path/to/dir} in
df8e8d
order to control the amount of files you want to produce as
df8e8d
base-rendition.  The deeper you go into the directory structure the
df8e8d
more specific you'll be about the component you want to produce. When
df8e8d
you cannot go deeper into the directory structure, you can use
df8e8d
@option{--filter} option to reduce the list of files.
df8e8d
df8e8d
@item --dont-commit-changes
df8e8d
df8e8d
Supress all commit and update actions realized over files, before and
df8e8d
after the action itself had took place over files in the working copy.
df8e8d
df8e8d
@item --update
df8e8d
df8e8d
This option extracts translatable strings from both XML-based files
df8e8d
(using @command{xml2po}) and shell scripts (using @command{xgettext})
df8e8d
under @file{path/to/dir}. Translatable strings are initially stored in
df8e8d
portable objects templates (.pot) which are later merged into portable
df8e8d
objects (.po) in order to be converted as machine objects (.mo).
df8e8d
df8e8d
Use this option each time you change translatable stirngs inside
df8e8d
design models and script files.
9c6e0d
df8e8d
@item --edit
df8e8d
df8e8d
This option edits the portable object related to @file{path/to/dir}
df8e8d
location.
df8e8d
df8e8d
Use this option after updating portable objects (through
df8e8d
@option{--update} option) in order to change the language-specific
df8e8d
information of translatable strings.
df8e8d
df8e8d
@item --dont-create-mo
df8e8d
df8e8d
This option supresses the creation of machine objects.
df8e8d
df8e8d
@end table
df8e8d
df8e8d
@subheading Description
df8e8d
df8e8d
The CentOS Artwork Repository exists to cover the visual needs of The
df8e8d
CentOS Project Corporate Identity. The CentOS Project is an
df8e8d
internationl project and sometimes requires contents in different
df8e8d
languages. So, in that sake, the CentOS Artwork Repository is designed
df8e8d
to produce content in as many locales as supported by The CentOS
df8e8d
Distribution, the platform that supports the whole CentOS Artwork
df8e8d
Repository, both in workstations and server.
df8e8d
df8e8d
@quotation
df8e8d
@strong{Tip} To know what locales are supported by The CentOS
df8e8d
Distribution you are currently using, run the following command:
df8e8d
df8e8d
@verbatim
df8e8d
locale -a | less
df8e8d
@end verbatim
df8e8d
@end quotation
df8e8d
df8e8d
The localization process is very tied to the input files we want to
df8e8d
provide localized messages for. Inside the CentOS Artwork Repository,
df8e8d
it is possible to localize XML files (e.g., SVG, XHTML, Docbook) and
df8e8d
programs written in most popular programming languages (e.g., C, C++,
df8e8d
C#, Shell Scripts, Python, Java, GNU awk, PHP, etc.).
df8e8d
df8e8d
@subsubheading Design models localization
df8e8d
df8e8d
Design models are used as input to produce most images and some other
df8e8d
contents as well. Design models are always XML-based files (e.g., SVG,
df8e8d
XHTML, Docbook), so the @strong{@code{locale}} functionality uses the
df8e8d
@command{xml2po} program to create protable objects from them under
df8e8d
@file{trunk/Locales/Models} directory. Portable objects contain the
df8e8d
relation between message id and message translation, as translator,
df8e8d
need to take care of.
df8e8d
df8e8d
Thanks to @command{xml2po}, it is possible for the
df8e8d
@strong{@code{locale}} functionality to separate designing tasks from
df8e8d
the translating tasks. It is possible for graphic designers to
df8e8d
concentrate their efforts on designing models in English language
df8e8d
while translators take care of their localization using the
df8e8d
@option{--update} and @option{--edit} options as much as it be needed.
df8e8d
df8e8d
Once design models have been localized, rendering them in different
df8e8d
language is a matter using the @strong{@code{render}} functionality of
df8e8d
@command{centos-art.sh} script. @xref{Directories trunk Scripts
df8e8d
Functions Render}, for more information about it.
df8e8d
df8e8d
@subsubheading Shell script localization
df8e8d
df8e8d
Additionally to design models localization, the @strong{@code{locale}}
df8e8d
functionality is also used to localize the @command{centos-art.sh}
df8e8d
script itself. The @command{centos-art.sh} script is a shell script
df8e8d
written in Bash, so the @strong{@code{locale}} functionality uses the
df8e8d
@command{gettext} tools to retrive translatable strings, create
df8e8d
portable objects and machine objects.
df8e8d
df8e8d
Thanks to @command{gettext}, it is possible for the
df8e8d
@strong{@code{locale}} functionality to separate programming tasks
df8e8d
from the translating tasks. It is possible for programmer to
df8e8d
concentrate their efforts in programming output messages in English
df8e8d
language while translators take care of their localization using the
df8e8d
@option{--update} and @option{--edit} options as much as it be needed.
df8e8d
df8e8d
Once @command{centos-art.sh} script has been localized, the translated
df8e8d
messages should be immediatly visible to you, the next time you
df8e8d
execute the @command{centos-art.sh} script
df8e8d
df8e8d
@quotation
df8e8d
@strong{Note} 
df8e8d
In order to localize translatable strings from English language to
df8e8d
another language you need to be sure the @env{LANG} environment
df8e8d
variable has been already set to the locale code you want to localize
df8e8d
message for or see them printed out before running the
df8e8d
@command{centos-art.sh} script.  Localizing English language to itself
df8e8d
is not supported.
df8e8d
@end quotation
df8e8d
df8e8d
@subheading Examples
df8e8d
df8e8d
@table @command
df8e8d
@item centos-art locale --update trunk/Identity/Models/Default/Distro/5/Anaconda
df8e8d
df8e8d
This command updates portable objects related to Anaconda default
df8e8d
design models of The CentOS Distribution major release 5. The update
df8e8d
action consists on adding new translatable strings or removing old
df8e8d
translatable strings from portable objects in order to keep both the
df8e8d
portable object and the design model consistent.
df8e8d
df8e8d
This command is executed by translators once the graphic designers
df8e8d
have committed updates to Anaconda default design models (e.g., slide
df8e8d
text changes).
df8e8d
df8e8d
@item centos-art locale --edit trunk/Identity/Models/Default/Distro/5/Anaconda --dont-create-mo
df8e8d
df8e8d
This command let translators to edit portable objects related to
df8e8d
Anaconda default design models of The CentOS Distribution major
df8e8d
release 5. The edit action is where the translator localize
df8e8d
translatable strings in English language to another language.
df8e8d
df8e8d
When portable objects for XML-base files are produced, there is no
df8e8d
need to retain the machine object format, so we used the
df8e8d
@option{--dont-create-mo}.
df8e8d
df8e8d
@item centos-art locale --update trunk/Scripts
df8e8d
df8e8d
This command updates portable objects related to
df8e8d
@command{centos-art.sh} script. The update action consists on adding
df8e8d
new translatable strings or removing old translatable strings from
df8e8d
portable objects in order to keep both the portable object and the
df8e8d
@command{centos-art.sh} script to be consistent one another.
df8e8d
df8e8d
This command is executed by translators once the programmers have
df8e8d
committed updates @command{centos-art.sh} script.
df8e8d
df8e8d
@item centos-art locale --edit trunk/Scripts
df8e8d
df8e8d
This command let translators to edit portable objects related to
df8e8d
@command{centos-art.sh} script. The edit action is where the
df8e8d
translator localize translatable strings in English language to
df8e8d
another language.
9c6e0d
9c6e0d
@end table
9c6e0d
df8e8d
@subheading Author
df8e8d
df8e8d
Written by Alain Reguera Delgado.
df8e8d
df8e8d
@subheading Reporting bugs
df8e8d
df8e8d
Report bugs to @email{centos-artwork@@centos.org} mailing list.
df8e8d
df8e8d
@subheading Copyright
df8e8d
df8e8d
Copyright @copyright{}  2009, 2010, 2011 The CentOS Project.
df8e8d
df8e8d
This is free software.  You may redistribute copies of it under the
df8e8d
terms of the GNU General Public License (@pxref{GNU General Public
df8e8d
License}).  There is NO WARRANTY, to the extent permitted by law.
df8e8d
41622d
@subheading See also
9c6e0d
df8e8d
@itemize
df8e8d
@item The GNU @command{gettext} tools documentation (@command{info gettext})
df8e8d
@item The @command{xml2po} command documentation (@command{man xml2po})
df8e8d
@item @ref{Directories trunk Scripts Functions}
df8e8d
@item @ref{Directories trunk Scripts}
df8e8d
@item @ref{Directories trunk}
df8e8d
@end itemize