How to translate a .po file into a .mo file ?

Here is a reminder to make a translation available for a given application. Nowadays, a huge number of open source softwares are internationalized in order to be available to non English-speaking users. Under Linux, the internationalization process consists of text files, named *.po files, which contain the translation from English to any requested language of all the menus entries for example. If you use an application that is not available in your native language at the moment but you have the po file, here is what you have to do : (tested on Ubuntu Lucid 10.04.1).

Make sure that the msgfmt tool is available. It belongs to the Debian/Ubuntu gettext package. Then , you only have to issue the following command : (ekiga.po is used as an example)

root@localhost:~# msgfmt -o ekiga.mo -v ekiga.po

No error messages are displayed until the process  above has failed. Now put the ekiga.po file into the following directory :

root@localhost:~# mv ekiga.mo /usr/share/locale-langpack/THE_REQUESTED_LANGUAGE/LC_MESSAGES/

If your locales are configured according to THE_REQUESTED_LANGUAGE value, your application will be translated and available into the requested language.

NB :  The command msgfmt works for any Debian-based distro. Nevertheless, you have to install the translations data available through packages for your working desktop environment (GNOME or KDE ). For instance, if you use GNOME, the packages language-pack-gnome-THE_REQUESTED_LANGUAGE and language-pack-gnome-THE_REQUESTED_LANGUAGE-base must have been installed. All the translation data available for THE_REQUESTED_LANGUAGE are located into the following directory :

/usr/share/locale-langpack/THE_REQUESTED_LANGUAGE/LC_MESSAGES/

Advertisements

One thought on “How to translate a .po file into a .mo file ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s