Xfce Wiki

Sub domains
 

Test your translations

When an application is being translated it is interesting to see the result. This allows you to figure several points, e.g. to appreciate your labour, to check for ugly vs pretty messages, to spot mistakes, etc.

The PO files are compiled into MO files with the command line tool msgfmt. These files are installed on the system with the same prefix1) as the application.

The theory

1. Make a backup
NB: replace <LANG> and <APPLICATION> appropriately (f.e. for the German translation of Xfburn the path would be /usr/share/locale/de/LC_MESSAGES/xfburn.mo).

cd /usr/share/locale/<LANG>/LC_MESSAGES/
sudo cp <APPLICATION>.mo <APPLICATION>.mo~

2. Compile the PO file

msgfmt -o <APPLICATION>.mo <LANG>.po

3. Install the MO file

sudo cp <APPLICATION>.mo /usr/share/locale/<LANG>/LC_MESSAGES/

4. Run the application
NB: you can test an application in several languages by tweaking the environment variable LANG. However the locales have to be available on the system (this is particular to the underlying system you are running), otherwise the translations won't show up.

NB: you can display available locales with the command line tool “locale -a”. To display the current locale run the command “echo $LANG”.

LANG=<LANG> <APPLICATION>

A real example

... connect to https://translations.xfce.org/projects/p/xfburn/ and download the PO file ...

poedit xfburn.master.de.po

... labour labour labour ...

msgfmt xfburn.master.de.po -o xfburn.mo
sudo mv /usr/local/share/locale/de/LC_MESSAGES/xfburn.mo xfburn.mo.orig
sudo cp xfburn.mo /usr/local/share/locale/de/LC_MESSAGES/
LANG=de_DE.utf8 xfburn

Afterwards if you are unhappy with the translations and want to test a new version…

poedit xfburn.master.de.po
msgfmt xfburn.master.de.po -o xfburn.mo
sudo cp xfburn.mo /usr/local/share/locale/de/LC_MESSAGES/
LANG=de_DE.utf8 xfburn
1)
/usr/local, /usr, /opt, etc