Translate software

From OpenHatch wiki


Do you know a non-English language? Or do you know a great piece of software only available in a non-English language that you can translate?

One very helpful and common way to contribute to an open source project is by taking the user-facing text, also known as strings, and converting them into a different language.

How it helps

When you translate software, you enable people to use software in their native language. This is something English speakers take for granted, and it's also one of the reasons many people recommend open source software. (For one example, see Bharat Operating System Solutions.)

Translating software is a great way to get to know the software better yourself. The translation workflow is based on using a program, finding text that is not yet translated, and identifying the best text to use in the target language. To choose the best text, you have to know more than just the target language of translation; you have to understand what that button really means.

It is also a great way to get more involved in a community. You become part of the release cycle and community working on the project.

Not all programs are enabled for translation; there is some technical work required to allow the program to choose non-English text in its interface. If you are willing to make those changes, many projects will be happy to accept those as patches or pull requests to the code.

Beyond all that, you make it easier for people to choose to use all open source software. Many people care about the freedoms behind free and open source software, and so being able to properly use an open source program to get their tasks accomplished is a true gift!

Technical background

The process of localizing a program has two steps. The first step is when the program's developers provide a mechanism and method for the eventual translation of the program and its interface to suit local preferences and languages for users worldwide.

Generally speaking, this requires two changes. First, wherever a programmer would write some text that would be presented to the user, for example:

   print "Is now an OK time to enable the robots?"

they would write something more like:

   print _("Is now an OK time to enable the robots?")

This enables the second stage, called message extraction. This finds all the strings that are annotated with the translation function (typically the _ character) and saves them into a list of all the original strings. (This is often a .POT file; read more at Wikipedia's article on gettext.)

You should be able to find these POT files in the project's source code repository, alongside the source code to the program.

For the process of translating to your chosen language, you find or create a language-specific file called a PO file based on the template.

The typical workflow for translating software is to submit patches/pull requests to the source code repository with your changed PO file. To make those edits, we strongly recommend you use a special PO file editor rather than a generic text editor.

A different workflow is that many projects now let you edit translations on the web. This lets you skip the steps of using a PO editor and of using version control to share your changes; you still will need to be able to use the program you are translating, to get a sense of where the strings appear.

How to get started

Find a suitable project:

  • Think of a program that you use, or you want to use.
  • Find its website, and look for a how to get involved section. Look for a special discussion of translation.
    • See if it provides special instructions; such as recommending a web-based translation tool.
    • If the website does not give special instructions, but suggests the authors have done the technical work to make translation possible, download its source code, and look for PO or POT files inside.

Now, get started translating strings!

  • If you are using a PO-based workflow:
    • If you have a PO file: Open up the PO file in your favorite PO editor (POEdit is a reasonable suggestion if you don't have a favorite), and find text that needs translation.
    • If you have a POT file but no PO file for your language, you may have to use the msginit command on the command line to create a PO file.
  • If you are using a TranslateWiki-based workflow:
  • If you are using a workflow:

Make sure to find the community:

  • Join the program's mailing list or IRC channel, and say hello and that you want to contribute in this way. The authors may have tips on doing the translation, such as special places to look for PO files.
  • Try to see if they have a special localization or internationalization community. Say hi to them, too!