\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\part{Translating Horde Applications}
\textbf{This information is valid for Horde 4 and later only. See <a href="https://wiki.horde.org/Doc/Dev/TranslationH3">Doc/Dev/TranslationH3</a> for Horde 3.}

This document is intended to help developers translate Horde 4 modules using the \textbf{/horde/bin/horde-translation} script.

See also \texttt{horde/docs/TRANSLATIONS}.

\section{The Translation Script}
<pre><code>
\$ php horde/bin/horde-translation

Usage: horde-translation [options] command [command-options]
       horde-translation [help|-h|--help] [command]

Helper application to create and maintain translations for the Horde
framework and its applications.
For further information, see horde/docs/TRANSLATIONS.

Commands:
  help        Show this help message.
  compendium  Rebuild the compendium file. Warning: This overwrites the
              current compendium.
  extract     Generate PO template (.pot) files.
  init        Create one or more PO files for a new locale. Warning: This
              overwrites the existing PO files of this locale.
  merge       Merge the current PO file with the current PO template file.
  update      Run extract and merge sequent.
  update-help Extract all new and changed entries from the English XML help
              file and merge them with the existing ones.
  cleanup     Cleans the PO files up from untranslated and obsolete entries.
  make        Build binary MO files from the specified PO files.
  make-help   Mark all entries in the XML help file being up-to-date and
              prepare the file for the next execution of update-help. You
              should only run make-help AFTER update-help and revising the
              help file.
  commit      Commit translations to the CVS server.
  commit-help Commit help files to the CVS server.

Options:
  -b, --base=/PATH  Full path to the (Horde) base directory that should be
                    used.
  -d, --debug       Show error messages from the executed binaries.
  -h, --help        Show this help message.
  -t, --test        Show the executed commands but don't run anything.

Please report any bugs to i18n@lists.horde.org.
</code></pre>
Any commands can be called with \texttt{horde-translation help COMMAND} for further information.

\section{Making a Translation}
\subsection{Intialize/Merge the Translation}
If this is the first time, run:

<pre><code class="language-php">
php horde-translation init --module=MODULE --locale=xx\_XX
</code></pre>
where MODULE is the module folder and xx\_XX is the locale (country and language code), e.g. en\_GB or es\_ES

If you didn't create one before, build the compendium with all existing translations for the locale from other Horde applications:

<pre><code class="language-php">
php horde-translation compendium --locale=xx\_XX
</code></pre>
Finally, try to get as many translations as possible from the compendium into the new translation:

<pre><code class="language-php">
php horde-translation merge --module=MODULE --locale=xx\_XX
</code></pre>
\subsection{Edit and Update the Translation}
Create the compendium file (do this one time only):

<pre><code class="language-php">
php horde-translation compendium --locale=xx\_XX
</code></pre>
Clean up obsolete entries:

<pre><code class="language-php">
php horde-translation cleanup
</code></pre>
Prepare the file to edit:

<pre><code class="language-php">
php horde-translation update --module=MODULE --locale=xx\_XX
</code></pre>
Edit the translation file \texttt{horde/MODULE/locale/xx\_XX/LC\_MESSAGES/module.po} using a suitable gettext editing program, such as KBabel or poedit and save the file.

Compile the translation:

<pre><code class="language-php">
php horde-translation make --module=MODULE --locale=xx\_XX
</code></pre>
If you want to see the changes right away, restart the http server (i.e. \textit{service httpd restart} in Fedora, <a href="https://wiki.horde.org/CentOS">CentOS</a> and similar OSes).

\section{Translating Help Files}
First extract all new and changed entries from the English XML help file and merge them with the existing ones:

<pre><code class="language-php">
php horde-translation update-help --module=MODULE --locale=xx\_XX
</code></pre>
Then edit the help file for the necessary language using a text editor or vi:

<pre><code class="language-php">
\$ vi horde/MODULE/locale/xx\_XX/help.xml
</code></pre>
Finally:

<pre><code class="language-php">
php horde-translation make-help --module=MODULE --locale=xx\_XX
</code></pre>
\section{Translating framework modules}
You \textbf{MUST} manually create a \texttt{locale/} folder in the base of the module in order for the translation script to recognize the module.  Then, you can use the translation script as normal to generate the appropriate files (the module name is Horde\_PACKAGE where PACKAGE is the package name).

\end{document}
