Xfce Wiki

Sub domains

Short Guide About Translating Messages

0. License and Authors

This document is provided under the Creative Commons Public License 2.5. It is based on the contributions by the following authors:

1. Intro

This is a short summary of the gettext documentation. See the Appendix if this information isn't sufficient for you.

2. Get the PO files

You can get the latest PO files from the Transifex platform, available at http://translations.xfce.org/.

Regarding Xfce, it's recommended having translation for the current stable version at first, the development version would be frequently changed unless they are frozen by developer.

3. Get the editor for PO file editing

You can use a text editor Emacs with `po-mode', Vim with ftplugin `po.vim' or a graphical PO file editor like `poEdit (requires wxWidgets)', `gtranslator (requires GNOME)', `KBabel (requires KDE)', these editor have special features for editing PO file. You can use normal editor like Mousepad, Vi etc. of course, but it's highly recommended using one of those editors.

Here are the links:

If you are going to continue as translator, you might want to learn one of above.

4. Contact with the former translator in your language

To save your time from duplicate work already on going, it's better to contact the translator in the header string,

  Last-Translator: Last Translator <foo@bar>

if that address isn't used no longer or you couldn't get touch with the last translator, then please post your message to the Xfce translations mailing list (xfce-i18n@xfce.org).

5. Prepare the PO file

To create the PO file for your language, simply type,

$ msginit

in the target po directory, according to your current locale, it creates lang.po in which the suitable header strings will be given automatically without your bothering. This newly created PO file, however, may not have UTF-8 charset depending on your locale, so you'll need to convert its charset to UTF-8 later.

Note: The command “msginit” works only if target po directory has generated .pot file.

6. Translate the messages

In the PO file you'll find something like this:

#: main.c:42
msgid "Hello world"
msgstr ""

If you want to translate to German, you would change the 3rd line to the following:

msgstr "Hallo Welt"

Don't touch the string behind “msgid”

If you find typos or the like, this string must be corrected in the source file. If you see a string with a “%” in it, then leave the part with “%” as-is and don't change the order of these “words”. Also keep the character after an backslash “\” as-is. For example:
msgid "%-8s are %d time faster than %s.\n"
msgstr "%-8s sind %d mal schneller als %s.\n"

\n” means “newline” in which line will be new-lined on output, or another example from Xfmedia:

msgid ""
"This is a printf-like format string controlling the display of the "
"playlist.  Xfmedia will replace the following symbols:\n"
"\t%p: Artist/Performer\n"
"\t%t: Track Title\n"
"\t%a: Album Name\n"
"\t%T: Track Number\n"
"\t%g: Genre\n"
"\t%y: Year\n"
"\t%f: Filename\n"
"\t%%: a percent sign"

in that case “\t” inserts the “tab” space on output, note that on translation, you should use actual “tab” space or “enter” instead of putting “\t”, “\n”.

You don't have to translate every message. If you cannot or don't want to translate a message just leave “msgstr ”“” as-is. Don't copy the string of msgid!

Some strings contain a single underscore (e.g., “_Edit list…” from Xfdesktop). In this case the underscore declares the following letter as accelerator key. In this example, the key combination <Alt>+E or sometimes <Control>+E would activate the GUI element associated with this string. You should use an appropriate character as accelerator in the translation as well, just append an underscore to selected character:

msgid "_Edit list..."
msgstr "_Liste bearbeiten..."

If you change the accelerator key, try to make sure that the chosen key doesn't clash with another one in the same scope. In rare cases, you might want to discard the underscore so that no accelerator will be available for the GUI element.

Okay, sometimes you see the special marks, format-indicator in your PO file like bellow,

#: ../xfce4-about/info.c:262
#, fuzzy
msgid "About Xfce 4"
msgstr "O XFce 4"

with the “fuzzy” mark, your translations never affect, probably you will ask “What's the fuzzy

", don't worry, the more you are familiarwith translation under gettext mechanism, the more you are getting know what ”fuzzy“ means, anyway if you translate a string, delete the line,
#: ../xfce4-about/info.c:262
msgid "About Xfce 4"
msgstr "O XFce 4"

now, the translated string will work for the certain place. “Then, how should I do the following case?” you might wonder,

#: ../thunar/thunar-properties-dialog.c:547
#, fuzzy, c-format
msgid "%s Info"
msgstr "%s Info"

in that case, ”c-format“ is format-indicator, i.e. string ”%s Info“ must be a C format string and, like above mentioned, you'll have to leave ”%s“ as-is. Simply remove ”, fuzzy“,

#: ../thunar/thunar-properties-dialog.c:547
#, c-format
msgid "%s Info"
msgstr "%s Info"

(more continues…)


  • An explanation for plural mechanism.
  • Commenting with ”#“.

6.1 Translation Context

The GUI often uses single words or short word combinations. When used as a frame title a colon is appended the English to disambiguate its meaning. Another possibility to disambiguate especially short strings is using the character ”|“ as separator. If the English text contains this character, the part up to the ”|“ may contain a comment for translator and/or simply declare a name space so that the word can be translated in a certain meaning even if the same word is used with different meanings in other places. For example (from Xfce4-panel):

msgid "tip|Info"
msgstr "Información"

In the translated string discard everything up to the first ”|“ and translate the rest only.

6.2 Order switching

Sometimes it is needed to switch the order of the c-formats. To do so you will have to change the %<format> against %<position>$<format>.

msgid "Device %s has %s space left"
msgstr "%2$s space left on device %1$s"

7 Convert the output to UTF-8 (if it's not already UTF-8 encoded)

$ iconv -f CHARSET -t UTF-8 ${lang}.po > utf8.po
$ mv utf8.po ${lang}.po

Replace CHARSET by the one you use e.g., if you are from Western Europe it's probably ISO-8859-1. Otherwise see what echo $LC_CTYPE says, and strip the part up to the . (dot). For example:

$ echo $LC_CTYPE
$ iconv -f eucJP -t UTF-8 lang.po > utf8.po
$ mv utf8.po ${lang}.po

If you use Vim you can also convert lines on the fly like this:

:,!iconv -f ISO-8859-1 -t UTF-8

This usually works even if your terminal doesn't support UTF-8 encoded character sets.

8. Checking and Submitting the PO file

Firstly, verify whether your PO file is valid:

$ msgfmt --check --check-accelerators=_ -o /dev/null ${lang}.po

You should get no warnings, but if you got them, fix it following outputted warning messages. After checking, you can send your translation to the Xfce Transifex platform. To get an account with upload rights you can follow the instructions found on the translations wiki page in the Getting started section.

Note: This part is so important that please don't post your translations to the list unless you have no warning.

9. Template updates

The messages may be changed from release to release and with growing functionality there will be more messages that should be translated. Thus, translation isn't something static. Every few month there will be a few more sentences to be translated.

The following part concerns the project maintainers. To update the PO files to reflect any changes to translatable strings in the source files, it requires full source codes in which you'll have to run

$ ./autogen.sh

will be required in the each module's directory at first, then simply update your files,

  $ cd po
  $ make update-po

This will scan the source files for translatable strings, will (re-)build the file ”package.pot“ and will use msgmerge to update the PO files from the POT file.

Sometimes, it requires updating POFILES.in in the first place, when there are strings in new source files.

10. Desktop files (4.2 branch only and it requires full source)

The desktop files for the 4.4 branch are translated directly in the po files. You only need to follow this procedure for the xfce 4.2 branch.

The Name, GenericName, and Comment keys should be translated. The format is:


For example (from Xfcalendar):

  Name=Xfce Calendar
  Name[he]=לוח שנה Xfce

Make sure the file stays UTF-8 encoded, language order should be alphabetically.

This isn't required if you're having translation for SVN trunk version, instead you'll have to install decent intltool. If you are using Emacs, ”desktop-entry-mode“ would be useful for checking file validation.

  • Here are the desktop files that should be translated:

11. XML files for desktop menu (it requires full source)

The translations for the desktop menu are translated directly in the po files for the development branch (post 4.4 branch). You only need to follow this procedure for the 4.2 and 4.4 branch.

You might want to localize desktop menu appearing by right click on the desktop, your files are,

  • For the 4.4 branch

to translate into your language, follow the instructions in those files, after translations and installation finished, the desktop menu will be automatically localized.

Note: If you have already installed those XML files but would like to check your modified translations on the fly, remove


then, newly translations will appear.

12. Checking your translations in the actual situation

As for the development branch, the relevant module should be built and installed. This is only for the brave and those that know what to do, instructions and information are to be found elsewhere.

As for the 4.4 branch, and assuming that the translator has this installed, it is a matter of running

$ msgfmt -c -o ${lang}.mo ${lang}.po
$ su
# cp ${lang}.mo ${xfce-prefix}/share/locale/${lang}/LC_MESSAGES/${package}.mo

and restarting the application.

13. Documentation translation

The documentations are translated inside the po-doc directories which contain usual POT and PO files. Those files are updated by the application maintainer, and are formatted into DocBook.

  • Maintain the documentation (job for the maintainer/developper):
    1. Run the ”configure“ script with the flag ”--enable-xml2po
    2. Update the POT and PO files with ”make -C po-doc update-po
    3. Update the XML files with the newly translated PO files with ”make -C po-doc update-xml

Note: you need the xml2po tool. It can be compiled from CVS GNOME or installed from your distro (check for the package poxml/gnome-doc-utils).

  • Compile the DocBook into HTML format (anyone who wants to check the results)
    1. Run the ”configure“ script with the flag ”--enable-xsltproc
    2. Run ”make -C docs
    3. The result is compiled inside docs/$the_docbook/$your_locale/html/

What you should do as translator, consists into editing the PO file of your locale inside the po-doc directory. If your locale doesn't exist yet, run msginit inside po-doc.

14. Web page translation

The following command line will checkout the translatable files for the web pages. This will create a local svn tree from which you can begin translating in your language the contents of Xfce's web page.

 $ svn co http://svn.xfce.org/svn/www/www.xfce.org/trunk/i18n/ www

15. Feedback

If you have comments, ideas or corrections, use:

Your feedback will be gratefully appreciated.

16. Appendix