Published
Thursday, May 24, 2012 - 09:23
Written by
bgm

English is the default language of CiviCRM, but many translations are available. For example, Russian, Chinese, French, Dutch and Japanese are 100% completion (or almost). Italian, Danish, Spanish, Swedish, German and Portuguese are also very advanced. There are 64 languages and variants on Transifex at the moment of this writing.

Translating CiviCRM a very difficult and long task: there are many very specific terms and there are more than 15,000 strings to translate.

Another challenge, and this is the main topic of this blog post, is the challenge of reviewing translations to ensure wide community participation while still maintaining a high quality translations.

Glossary

Having a common glossary for translators can help making sure translators use the same word consistently. It can also help language variants (fr vs fr_CA, spanish translations, etc) to try to merge as much as possible, but explain the differences.

For examples, see Translator resources in the wiki.

Anyone can signup for an account in the wiki, then create a new glossary. There is also an option to receive an e-mail notification when someone else has modified the glossary.

Reviewing changes with Git

Git is a revision control system. In other words, it tracks changes in a file. Since translations are exported as regular text files, we can manage them with git.

Git is a rather technical tool, so if you are not familiar with it, no need to. Translations are exported from Transifex to Github once per week (or more). When the changes are sent to Github, a script checks for the latest translator of the file and sets the "attribution" of those changes to the translator. In short, you can review in Github "who updated what, and when".

To avoid any confusion:

  • Transifex: is an online service to manage translations. This allows translators to easily update the translations using a web interface, without any other tools. It also manages "offline" translations (for those who prefer to use a translation tool).
  • Github: is a hosting provider for Git repositories.

Here is how to review changes using the Github web interface:

  • Go to https://github.com/civicrm/l10n
  • In the file browser of that page, go to the "po" directory, where the translation files are stored, then select the language code corresponding to the translation you wish to review (ex: "fr" stands for "French", while "fr_CA" refers to the regional translation for French Canada). Notice that the end of the line for each language indicates who has done the latest change.

  • Click on a file in order to view its contents. You will then have 3 options available in the upper-right corner of the textbox: raw, blame and history. Raw allows you to download a copy of the file (without any other formatting). Blame shows the same file, but prefixes each line with the author of the latest change. History shows the latest changes.

  • When viewing the History, you can click on the "hash identifier" associated with the change (git associates each change with a unique hash). In the above example, it is "c3c563892d", the button on the right side of the screen.

  • You can now see the exact change:

Comments

Hi,

 

That's great to push it on github. and the .mo files are updated between civicrm versions, that's fantastic for those that don't want to compile it themselves.

 

One problem identified I had is when the same work is translated differently based on the context. For instance "home" in english is translated into "accueil" if it's the homepage, but "domicile" if it's the location type. Do you have an idea how to solve?

Yep, I forgot to mention that I regularly recompile the "mo" files in github, so that people can easily update their translation. Before a release, the .mo files are committed to SVN (l10n sub-repo). I'm still working on simplifying/automating that (all this is based on scripts by Piotr and Michal, and they are awsome, but there's always room for more automation, but I was waiting for the git migration of civicrm trunk itself).

w.r.t to "Home": Gettext has the notion of context (msgctxt). Currently CiviCRM uses contexts for "province", "country" and "menu".

It might be as simple as to just fix the code where "Home" is mentioned in a context of a menu item. Right now, the "menu" context is used only for titles generated from the xml files. Hmm, well, fixing this requires to change the ts() function, who calls crm_translate, and so on. Want to open an issue? :)