Tari.in
Batteries not included.
  • Nav
  • Bottom
  • Tux
  • Kowalski
  • Rico
  • Skipper
  • Private
  • Comment
  • Contact
  • Top
  • There are no visitor comments on this page

    Translating Applications

    Note: Check whether the application you wish to work on has its translation set up on Launchpad or Weblate. It may save you a lot of time, since all the work can be done from your browser, and the translations will most likely be pulled into the source and built automatically.

    Getting Started

    Translating an application is extremely easy. First, you need to obtain a template file from the developer (usually named appname.pot). All you then need is a simple text editor (GNOME's default gedit, for instance), and you need to be familiar with common software terms in both the source and target languages. For strings that are ambiguous or lack context, the developer usually provides a short comment to aid the translator. If you still run into difficulties, have a look at the software in action, or ask the developer for clarification (the E-mail address is usually in the first few lines of the .pot file).

    Translating Simple Text

    The .pot file consists of a header, followed by alternating msgid and msgstr keys. The former contain the original text, while the latter should be used by you to type in the translation. You are only interested in these two, and you may only edit the msgstr.

    msgid "I am an example"
    msgstr "Je suis un exemple"
    

    Translating Multiline Text

    Newline characters (\n) must ALWAYS be at the same position as in the source text, and you must NEVER add or delete a line or a newline character!

    msgid ""
    "Copyright (c) 2012 SOMEBODY\n"
    "\n"
    "Thanks to SOMEBODY ELSE."
    msgstr ""
    "Copyright (c) 2012 ALGUIEN\n"
    "\n"
    "Gracias a OTRA PERSONA."
    

    Placeholders

    Since it is nearly impossible to replicate the word order, plural forms, articles, etc. into the target language, developers use so called placeholders, or substitutions. These are LITERALS placed in curly braces that you copy to the translation without making a change. The application replaces these at runtime regardless of the language. The same is used when the content changes dinamically.

    msgid "There are {num_seconds} seconds left for user {user_name}"
    msgstr "Benutzer {user_name} hat noch {num_seconds} Sekunden Zeit"
    

    Signing Your Work

    After you translate all the strings, look for the following line in the header:

    "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    


    and replace it with your own name and address. You must provide valid information - it affects future communication, bug reports, etc. as well as making it possible to credit your contribution in the appropriate places.

    Renaming the .pot File

    The naming convention for translation files is as follows:

    language_LOCALE.po (note, there is no t in the extension of the translation)
    


    where language is a 2 letter lowercase ISO 639-1 language code and LOCALE is a 2 letter uppercase ISO 3166-1 country code. All this is connected with the "_" character.

    How you follow this depends on whether you are only internationalising, or both internationalising and localising:

    #Let's suppose you are internationalising to English, providing a general English translation:
    en.po
    
    #Now here you have made an English internationalisation but with two localised versions, each containing the British and American translations, respectively:
    en_GB.po
    en_US.po
    
    #Here is general Spanish vs. Mexican:
    es.po
    es_MX.po
    

    Submitting Your Work

    Version control, bazaar, git and the rest are beyond the scope of this text. Unless you have been instructed otherwise, simply send the file to the first E-mail address at the top of your .po(t) file.

    Applications

    Poedit is a nice GTK+ translation tool. If you have a larger project and you don't want to type directly into the .pot file, you may wish to give it a try.

    Examples

    See the translation template file for the xeroxscanner application here, and over here is the finished .po file of the German translation for the same app.

    Add your comment to this page

    Note: If you wish to report a bug, request a feature, or ask a question about an application - please do so by using the appropriate GitHub link on the application's page.

    7 + 9 =
    Please wait, this could take a second...