Appendix B. Translating Koha

Table of Contents

1. Special problems
1.1. Bengali
1.2. Turkish

Because Koha is open source, it can be translated to most languages without much trouble. The tools and instructions you need are found in the intranet/scripts/misc/translator directory of your Koha installation. The instructions are contained in the file translator_doc.txt, which is reproduced here:

TRANSLATION TOOL, V3.0:
======================

This translation tool should greatly help Koha translators. It's composed of
2 scripts (with a number of associated perl module files):

 1. xgettext.pl, that extracts the texts in a template, and which is called by
    the script; and
 2. tmpl_process3.tmpl, which can do 3 things:
     a. create a file with all the "translatable strings" in all files in a
        directory (& its subdirectories),
     b. update an existing translation file, and
     c. rebuild translated templates from English & translation file.

Call tmpl_process3.pl --help to get a more detailed explanation. Some
additional explanations are also available by calling perldoc tmpl_process3.pl.

HOW TO TRANSLATE Koha:
=====================

 1. Create your translation file (assuming your current directory is this
    directory, i.e., misc/translator):

        ./tmpl_process3.pl create -i ../../koha-tmpl/opac-tmpl/default/en/ -s po/css_opac_fr_FR.po -r

    (In the above example, ../../koha-tmpl/opac-tmpl/default/en/ contains the
    English templates in the "default" theme, and po/css_opac_fr_FR.po is where
    you want the generated PO file to appear. The use of relative paths for the
    English templates is recommended; it makes the resulting PO files slightly
    shorter and more usable in a team environment. Absolute paths are certainly
    fine, and might be better if there is only one translator for your
    language.)
 2. Translate your css_opac_fr_FR.po file using a text editor or a PO file
    translation tool.
 3. Create your translated templates:

        ./tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/default/en/ -o /home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/fr2/ -s po/css_opac_fr_FR.po -r

    (In the above example, /home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default
    /fr2/ is where you want your translated templates to be saved.)
 4. Copy images/css files in your new directory (as they are NOT moved by
    tmpl_process3.pl install).

If something changes in the English version:

 1. Update your translation file:

        ./tmpl_process3.pl update -i ../../koha-tmpl/opac-tmpl/default/en/ -s po/css_opac_fr_FR.po -r

 2. Translate your newly updated css_opac_fr_FR.po file. Look for strings
    marked as "fuzzy" and strings that are not translated.
 3. Create your translated templates:

        ./tmpl_process3.pl install -i ../../koha-tmpl/opac-tmpl/default/en/ -o /home/paul/koha.dev/koha/koha-tmpl/opac-tmpl/default/fr2/ -s po/css_opac_fr_FR.po -r

 4. Copy new images/css files in your new directory if needed

WEAKNESSES
==========

For a somewhat up-to-date list of weaknesses, please run perldoc xgettext.pl
and perldoc tmpl_process3.pl and read the BUGS sections.

COPYRIGHT
=========

  * Paul Poulain (paul.poulain _@_ free.fr) & Jerome Vizcaino (vizcainj _@_
    esiee.fr)
  * Parts of V3.0 by Ambrose Li (acli _@_ ada.dhs.org)

These instructions require some additional explanation for those who are not familiar with "PO files."

A PO file is a translation tool used by the GNU gettext utilities. See http://www.gnu.org/software/gettext/manual/ for a detailed description of gettext, but you don't have to be a gettext expert to translate Koha. The tmpl_process3.pl script takes care of the difficult stuff for you. When you run the script with the create option it extracts information from any set of Koha templates which you name (usually the default English templates) and creates a PO-format file with all of the terms you need to translate. The file will contain a list of entries that look something like this:

#: ../../koha-tmpl/intranet-tmpl/default/en/help/admin/categorie.tmpl:11
msgid "\"C\" (Children) is a borrower category that has a \"guarantor\""
msgstr ""

#: ../../koha-tmpl/intranet-tmpl/default/en/help/admin/categorie.tmpl:9
msgid ""
"\"I\" can be used for institutional members, like other libraries that "
"borrow from you, in which case Koha expects slightly different information "
"about the institution;"
msgstr ""

All you need to do now is insert the translation of each msgid between the quotation marks of the corresponding msgstr. This can be done using any text editor, or is even easier if you use a PO editor like kbabel. When you are done translating everything, run tmpl_process3.pl again with the install option and it will create all the Koha templates in the new language. If the default templates are changed, run tmpl_process3.pl with the update option and check the resulting PO file for missing translations.