Koha Test Wiki MW Canasta on Koha Portainer

Test major Koha Wiki changes or bug fixes here without fear of breaking the production wiki.

For the current Koha Wiki, visit https://wiki.koha-community.org .

Translating Koha

From Koha Test Wiki MW Canasta on Koha Portainer
Jump to navigation Jump to search

Koha is translated into a growing number of languages. As the community keeps improving Koha and is constantly adding new features, this is a never ending task for the translators and help is always welcome.

You can find out which languages Koha is translated to, looking at our Pootle translation server.

Get started

In order to help out with translating, the first thing you need to do is create an account on Pootle - the Koha translation server.

After that you can start to make suggestions for the language directly. If you want to submit your translations directly or moderate suggestions, please introduce yourself on the koha-translate mailing list, so you can be assigned the proper permissions. It will also help to get in contact with other translators of your language.

Adding a new language

If you want to start translating Koha into a language that is not in the list, please send a message about it to the mailing list, and the current translation manager will help you to get started.

Step 1: Have the language added in the language list for advanced search

Example: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=29596

Step 2: Have the language added to the translation platform

Translation Tools

Pootle

Pootle is a great way to translate for teams of multiple translators and is therefore the preferred way for a lot of the translators. It's also quick and easy as you don't have to install anything and can work on translations wherever and whenever you want to.

Alternative software

If you get started with a new mostly untranslated language or prefer to work locally, you can download the .po files and use a special editor to work on them.

Important: If you are working with other translators, please let them know, as their changes will most likely get lost/overwritten, when you upload the files to Pootle again. You will also have to get the permission to upload files added to your account.

Hint: Even if you translate using Pootle, the editors can be helpful in validating/testing your translations for errors. Sometimes translation mistakes can lead to a language not installing correctly, checking your translations regularly can help to prevent that.

Tips and tricks

Placeholders - %s

In the strings to translate, you will often see one or multiple %s. Those are placeholders for variables or template instructions. It's important that the number of %s in the translated text matches the English version exactly. But don't get too worried by them, you can always skip those at the beginning or mark your translation as 'needs work' or just make a suggestion.

If you are a bit more experienced, you can get a clue about the meaning of the placeholders by looking on the left side in Pootle, for example:

 Expiration date: %s

Left side:

 Comments: %1$s: dateexpiry | $KohaDate

It means that the %s will be replaced by the value of the dateexpiry variable, which in this case is the date a patron account expires on.

Translating system preferences

The po file for translating system preferences is a bit different to the other files. Usually all strings in the po files will display for you in alphabetic order. As a system preference description can consist of several lines and strings, it would be hard to make a good translation that way. So in order to help translators, a comment with the preference name has been added to all strings, so they can be easily searched for by the pref name and all strings for a preference can be translated sequentially. The trick is, that the comment itself is not added to the translated string. For example:

 acquisitions.pref#AcqCreateItem# Create an item when

The correct Spanish translation will be:

 Crear un ítem cuando

Searching for phrases on Pootle

When searching for a phrase in Pootle the results can be a bit unexpected as it will bring up all entries that contain at least one word of the phrase. In order to make the search more exact, click into the search input field and check "Exact match" in the options shown.

Testing your translation

If you download the po files, you can test them for errors from the command line.

First make sure you didn't make any mistakes by validating the po files:

 msgfmt -c <your_po_file>

msgfmt comes with the gettext package.

Note: Some po file editors as listed above also offer this functionality.

If you have a test environment for Koha, you can find out how to install/update po files yourself on Installation of additional languages for OPAC and INTRANET staff client.

Updating the po files in your installation

Note This will only work in a git based development installation and not on a package installation.

This will update the po files in your installation using the current templates:

  • Run `yarn install` and install Locale::XGettext::TT2 if necessary
  • Run `gulp po:update`

Then you can either check the po files or check in Koha by installing a language with the updated files:

  • Run `cd misc/translator && ./translate install <lang>`

To create a completely new language for testing, you can use:

  • Run `gulp po:create --lang <lang>` and verify that it created all po files for that language


See: Bug 25067

See also