PoEdit tutorial: how to translate free software projects

If you are reading this it is likely that you have already gotten into the wonderful eggplant of the translations. Congratulations and ... patience. Everything is learned with time and desire.If you ever wanted to translate to contribute your grain of sand to the world of FOSS (or you need a tool to add language options to a website), and what you expected was a plain text in English (for example) to transfer it to another language, you will have realized (as I told myself) that it is not like that simple.

But it is not much more complicated either. In these brief lines we try to explain the most common case, which is that you are assigned a file format .pot to translate.

This is a contribution from Daniel Durante, thus becoming one of the winners of our weekly competition: «Share what you know about Linux«. Congratulations Daniel!

What is PoEdit?

Poedit is a translation tool, but be careful, let's not confuse it with a translator.
There are other programs that have the same functionality but I think that PoEdit is the most widely used. PoEdit does not translate like a program whose purpose is that, but rather helps us in the task of translating a text from one language to another. That is, it will present us with strings of characters in a language and we are the ones who must translate them into the desired language.

In principle, one may ask, and for that I need a program? Why not directly use text editors such as gedit or the windows notepad? The answer is very simple: PoEdit produces an output of the translated strings in a format prepared to be included directly in the directories of a server that store the pages in html, php code, etc. so it will be recognized as an immediately functional translation file when placed in the translation files directory. Obviously there can (and usually) be more than one file in these directories destined to store the translations into different languages, where each file contains information about what and how to represent the characters of the translation for a given language.

The files that PoEdit handles are template files, ending with the extension .pot, translation files, ending with the extension .po and file.mo, which are compiled files that make their access faster. The latter are created automatically if we specify it in the PoEdit configuration.

PoEdit exists in versions for GNU / Linux, Windows and Mac OS X.

Template files and translation files

Do you remember how a word processor handles a template? Well, something similar happens with PoEdit. The template file contains the strings to be translated and some spaces reserved for some data that will later be filled in when we start the translation process. These data, in addition to the original and translated literal strings, are, for example, the name of the last translator (since the task could have been started by a translator but not finished by the translator), the name of the translation team, the character set , etc. They are like a kind of metadata that give information about the translation file.

But to translate from a template…?

Just make a copy of the template to another file that you will rename in the same way but with the extension .po Well, not exactly in the same way, since so that you know what language it is going to
If the original is to be translated, a two-digit code must be added to the end of the template file name, before the extension.

For example:

Let's suppose a website in English language. Its main page is called index.html, to translate it we will have to have a template file called index.pot (the passage from index.html to index.pot is another process that we do not enter). When we have that index.pot file, we simply rename it to index.es.po, if Spanish is the language to which we are going to translate it.

Once the file is named like that, we can start to process it with PoEdit.

In the following image you have a fragment of the .po file where you can see the strings to be translated (they are the ones that follow the literal msgid in quotes) and the place where the strings translated by us with PoEdit will go (within the quotes that follow the literal) msgid.

If the question arises and I cannot edit the .po file and put the translation directly between the quotation marks that follow msgstr ?, the answer is Yes, although it is more comfortable and more orderly to do it with PoEdit (not to mention that it would be necessary to enter manually in the correct place the metadata that we talked about before, and it is better to leave that task to PoEdit; also we would not have the option to open the compiled .mo file).

In the following image you have the header of a .po file where the metadata regarding the file appears:

In the .pot file this metadata would not contain information, while in the .po file the information referring to each item would appear.

Installation and configuration

PoEdit comes in the GNU / Linux application repositories for Debian 6.0 stable / main. I suppose that also for other distros based on .deb packages, its installation is therefore direct, either using applications such as Synaptic or the apt command line manager, in the form:

apt-get install poedit

After its installation, we access the program and proceed to specify the preferences in Edition → Preferences, where we will put our name, and email address. The rest we can, in principle, leave it as Poedit presents it.

Working with the .po file

First we configure our file in Catalog-> Options as indicated in the following image:

It is important to fill the Plural Forms section with the string nplurals = 2; plural = n! = 1; You will put the rest in a personalized way.

In the Folders tab we will freely select a directory on our computer where we want to have the translations,

After doing this, you will see if you want to open the .po file with a plain text editor that the meta-data we were referring to has changed.

All ready to start translating the strings that will appear on the main PoEdit screen with a format similar to the following:

Where we have already translated and included in the lower window the translation of the string that appears above. It only remains to save the changes.

What is that fuzzy?

When we are not clear about the translation of a string but we know how to approximate its translation, we must mark it as fuzzy. In this case, the translation is incomplete and the .po file can be sent to another translator who will review these strings (actually, in the process of several translators and reviewers, everything is reviewed)

Well, as the end of this little tutorial I will tell you that a vision of the complete text is useful, not structured in lines as presented by PoEdit.

To extract the text only in Spanish we use the po2txt command:

po2txt -w 75 item-name.es.po item-name.es.txt

-w 75 indicates the line width at 75 characters.

(you must have the gettext and translate-toolkit packages installed)


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Pehuen Raineri said

    AL poedit I take it well, the explanation is very good but when I want to extract the text it throws an error. I have to put the path to the file?

    goes what I get:

    user @ ubuntu: ~ $ po2txt -w 75 English.po English.txt
    processing 1 files ...

    po2txt: warning: Error processing: input English.po, output English.txt, template None: [Errno 2] No such file or directory: 'English.po'
    [##########################################] 100%
    user @ ubuntu: ~ $ po2txt -w 75 ^ Cglish.po English.txt

  2.   From Xa said

    If you are interested in locating web software, PC software, mobile software or any other type of software, I warmly recommend this quick and intuitive localization tool: http://poeditor.com/.

  3.   Anymex. said

    I think I got lost in a part of the article but I don't understand, what are these files for?

  4.   David Segura M. said

    For the translations of the different programs, when you want to help translate a project into other languages ​​(such as Pidgin, Qcomicbook etc etc) the standard used is this type of file because for the reasons explained in the article it makes the task easier .

  5.   David Segura M. said

    Thank you very much for your contribution, it clarifies many doubts I had, because although there are some projects that allow translation directly on the internet or Launchpad as Marlin used to do, for the majority the .po format was used and its edition was still not clear to me!

  6.   jot said

    In case someone can use:
    There is a page that translates with both Google and Microsoft simultaneously:
    http://www.traductor–google.com

  7.   Diego Bruschetti said

    programs like OmegaT? it would not work?

  8.   erknrio said

    Sorry for my ignorance but I was trying to create my own website in several languages ​​and I don't know how the translations are done, let me explain:

    I have a default .po in the Spanish base language (Spain) and I am creating another one to translate it to English en_EN. What I don't know is how I can check that the translations load correctly. Does it load automatically based on the language of the visitor's browser? Should you create an intermediate file? Should I put the typical flags and according to which one is pressed, one translation or another is loaded?

    Honestly I'm sooo new to this and just starting to use poedit like knowing everything underneath that :(.

    Note: I use poedit in Windows 7 64bits and in the .po language (when creating the new catalog) I did not get a dropdown. I simply put Spanish and English.

  9.   selena said

    Hello! If you are interested in locating any type of software, I warmly recommend this quick and intuitive locating tool: http://poeditor.com/.

  10.   natali said

    I use poedit to translate texts and I would like to know how I can count the characters that I have translated and thus be able to make accounts to collect what has been translated, I can't find a way to do the count of translated characters…. Can this be done?

    1.    photocopier said

      to be able to make accounts to collect what is translated?
      I think you have not found out very well how the subject is going, right
      read the gpl license

    2.    erknrio said

      You cannot do it, the only thing would be to copy those sentences to a text editor (free office writer, word, etc.) and there see the number of characters in the sentences.

  11.   Bill said

    If you are going to translate into another language, the information about plurals in the Catalog-Properties: Plural Forms window can be found in:
    http://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html