Translating Koha

From Koha Wiki
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 Weblate translation server.

Get started

In order to help out with translating, the first thing you need to do is create an account on Weblate - 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 translation mailing list, and the current translation manager will help you to get started.

Translation Tools

Weblate

Weblate 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 Weblate again. You will also have to get the permission to upload files added to your account.

Hint: Even if you translate using Weblate, 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.

Dictionaries

Koha project in Weblate has two dictionaries available.

"Base terminology"

Sample of how glossary entries are displayed, red background is forbidden translation, yellow means to not translate the original, white background is normal

This is the Koha terminology glossary. This confined list of Koha-specific and librarian-specific words and terms is intended to help create consistency of translations in a given language.

See also: Terminology

This dictionary is meant to be concise vocabulary that serves as a reference for translators in all languages. All the strings added to it apply to all languages and should be translated to all languages, allowing your translators to follow certain phrasing conventions.

Once the glossary is populated, the matching items will display in the right pane of the translation interface of regular translation components, consisting of original word, target word, and provided context explanation if available.

Translators:

  • Translate the phrases as they should be used in your language. Take into account the translation explanations above the phrase you're translating!
  • You may translate the context explanation into your language, but only if it makes sense and doesn't apply just to the English original. Likewise, you can adapt the original or create a brand new one if there's any extra notes to be aware of in your language. Note that both explanations are going to be visible at once.
  • Certain translations are marked as forbidden, with explanation provided. Sometimes it means these words shouldn't have been used in the original at all, sometimes it's only a warning about not using them in certain contexts. For these terms you should always provide a translated explanation text as well. It is up to you whether you decide to provide a "correct" target translation if applicable, or whether you translate it directly and only denote proper usage in the explanation, based on the individual term and why it was marked as prohibited. Make sure your translators will know what's going on when they see it.
  • Please translate only the existing words and definitions into your language. If you want to add language-specific terms to a glossary, please use the other one called "Terminology" rather than this one ("Base terminology").
  • If you think "Koha Terminology" is missing a word that fits in here, suggest its addition to the source to the maintainers.

Maintainers: Add new terms to English source within reason. The newly added terms should be specific to Koha or librarian vocabulary, where a consistent translation of a given word within the language is desired. Avoid adding generic words here, where Koha context is not needed for proper translation at all.

"Terminology"

This is a generic dictionary for all words that don't apply to the above. Translators may, if desired, add any terms and notes they see fit in here, which might be specific only to their language. The translators should not attempt to translate any "missing" words from English that exist in the other languages here. Instead, new terms should only be added here manually on-demand. Currently, some communities use this dictionary extensively, while some don't make use of it at all.

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 editing' 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 juste above the string in Weblate, for example:

 Expiration date: %s

Juste above the source string:

 %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 Weblate

When searching for a phrase in Weblate 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, you can use many criteria (phrase match, for example but also among strings with sugestions or comments, strings changed by a chosen user...)

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