Skip to content

HowTo: Translations

Mario Cianciolo edited this page Sep 20, 2016 · 8 revisions

Translating Multiload-ng to a new language is very simple. Here are required steps.

Step 1: download the source

Using git

Open terminal in a directory of your choice, and type:
git clone https://github.com/udda/multiload-ng

Not using git

Download a ZIP containing the source here. Unpack in a directory of your choice.

Step 2: create template file

The proper way

You will need xgettext tool, contained in gettext package. You probably already have it installed, if not consult your distro documentation for install instructions.

Once you have xgettext, move to the directory where you downloaded the source and execute the following command:
xgettext --no-location -k -k_ -f po/POTFILES.in -o po/template.po --package-name=multiload-ng --add-comments=xgettext --from-code=UTF-8

Don't use -i (indent) option as it will mess up localization of .desktop files.

Ignore any warning about invalid non-blank line. This is due xgettext does not recognize Desktop file type from its raw extension (.desktop.in.in)

This will create an empty translation file in po/template.po. If this file exists and is already partially translated, you can join new translatable strings appending -j to the above command line.

The easy way

If you are

  • too lazy, or in a hurry
  • not interested in translating lastest code

you can just take an existing translation (language doesn't matter) and then change author, language, and, of course, translations!

Note that this way you could miss some strings (added after the release of edited .po, or original translator might have forgot some lines). Make sure to double check. In any case, when you send translation to me, I will notice you about any missing string.

Step 3: translate

Now it's time to translate! You can use specialized tool or edit directly the source.

Use specialized tool

Install a CAT (Computer Aided Translation) tool that supports gettext format. I recommend GTranslator. Edit your template.po, translate every string and save the file.

Don't forget to set metadata too (date, author, language, ...)

Edit directly the source

If you don't want to use external tools (and you know how to manually edit a .po file), you can open template.po with any text editor of your choice. Translate every string and save the file.

Don't forget to set metadata too (date, author, language, ...). They are located at the beginning of the file.

Step 4: test

Once you have a translated file, you can test it. Rename the file with the ISO code of the translated language (like es.po for Spanish or it.po for Italian) and put it into po directory of the source.

Build and install the plugin (instructions in README) and run into with the new language. You can test it easily with standalone plugin:
env LC_ALL=es multiload-ng

Replace es with your language.

Step 5: submit

Congratulations! You just translated an application into your language!

You can now send translated file to [email protected], or make a pull request, so it can be included in the source.

Thank you!