Översättning av LXDE-komponenter

Från LXDE.org
Hoppa till: navigering, sök

The LXDE Project is currently discussing how to make it easier for translators to contribute. We are discussing to use Transifex or Launchpad. See the related forum post here: http://forum.lxde.org/viewtopic.php?f=12&t=35

In the meantime you can contribute by editing .po files. In the following a description how to do this. It is an early draft, please add information and correct it, if you find mistakes.

How to translate .po-files for LXDE components

Get the code

First of all you should get the latest code from svn. To do so type in the following

 svn co https://lxde.svn.sourceforge.net/svnroot/lxde/trunk/ ./lxde

into a Terminal. You also can use a script for this.

# svn_co_lxde.sh
# autor maces
if [ -z $1 ]
	xterm -e $0 copy
        echo "starting"
        echo "------------------"
        svn co https://lxde.svn.sourceforge.net/svnroot/lxde/trunk/ ./lxde
        echo "------------------"
        echo "(program exited with code: $?)" 		
        echo "Press return to continue"
        #to be more compatible with shells like dash
        read dummy_var

The script opens xterm and execute the same command as above. Make sure to make it executable (chmod 755 ./svn_co_lxde.sh). You now should have the latest code in ./lxde.


In order to start translating, there's a vast amount of tools available. You want to make sure that all intltools and automake and similar are installed on your system for that step.

Getting the code

Normally, translation templates do already exist in the checked-out folders. If not, here's what you are going to do:

 intltool-update -m

will inform you if any source files are missing. If this happens, you should file a bug against the application.

Then create a new POT file (POT is a template) using:

 intltool-update -p

This will create an empty POT file using the applications name.

Initial empty translation

Now, there's an empty template file for beginning translating. However, there are more tools to make your life easier:

 msginit -o lang.po

will simply copy the template file, and insert some information your asked for. Its purpose mainly is to keep the headers intact and to reduce complexity a little.

Another way of starting a new translation is to use intltool. intltool will use the file po/POTFILES.in (and po/POTFILES.skip if any) to read through the source code files and extract translatable strings. It is vital that the POTFILES.in is up to date. Copy this file to your <country-code>.po (for example, sv.po).

Translate this file and submit it. Make sure that you add your name and mail address in the boiler plate (first few lines). Example:

 # Swedish translation for lxterminal.
 # Copyright (C) 2009 Free Software Foundation, Inc.
 # This file is distributed under the same license as the lxterminal package.
 # Daniel Nylander <po@danielnylander.se>, 2009.

If the package names have not already been inserted automagically, you may want to ditch the developer's because it's their job to deliver correct template files with the package names and copyright already being inserted. But please be so kind to insert them as shown above.

Update an old translation file with new/changed strings

If you want to update an older translation file using intltool, it's a easy as sliced bread. Use this command to update your file:

 intltool-update <language-code>

For instance, intltool-update sv

Things do even become more easy, incurring a little bit of overhead, by using

 make update-po

This will update all translations in your folder and notify you of number of untranslated, translated and fuzzy strings in the translation files.

FIXME: Someone might want to write a simple script with find -type d -name *.pot and do the intltool stuff and do the msginit afterwards as well, read $EDITOR for opening the newly created file.

And now... go on with translating! See sections below for further instructions and pointers.

Translate with a program

Choose a Program from the list at the end of the page.

Get some feedback

Frequently, these tiny accelerators (_) are overseen when translating files. However, they are nice and convenient for all kind of users (those with reluctance to mice, those with disabilities, ... as they offer accessibility of menu items, checkboxes and buttons by typing letters only, making access really fast and comfortable) and hence you want to insure that they are all correctly translated:

 msgcheck -o /dev/null --check-accelerator=_ lang.po

This will tell you where you broke your translation or forgot to translate a string.

Test your translation

Now, you have translated everything, all accelerators are included as well in a convenient style, i.e. no duplicate accelerators on dialogs and in menus, and want to test your translation.


 make update-po && make && sudo make install clean

will check your translations, compile them and install them in the proper location. However, sometimes your make environments are not available or you patch a regular installation from your distribution. That's when you are gonna enter

 msgfmt -o lang.gmo lang.po

which is gonna produce the compiled translation file that only needs to be copied over the existing translation, e.g. in /usr/local/share/locale/pt_BR/LC_MESSAGES/Thunar.mo for the component Thunar and Brazilian Portuguese.

Upload translation

There are (at the moment)two ways to upload the translations.

Way1 - The tracker

For this way you need an SF.net account. Go to https://sourceforge.net/tracker2/?group_id=180858&atid=894871 and click on add new artifact. As subject use something like "German translation for lxmusic" and choose "Translations" as Category. Type in a nice text and don't forget to attach your *.po file. After this click on Add Artifact and you are ready.

Way2 - The Mailinglist

For this way you need to subscribe to translation@mailinglist.lxde.org. If you are subscribed write a email to translation@mailinglist.lxde.org with Something like "German translation for lxmusic" as subject. Type in a nice text and don't forget to attach your *.po file. After this send the email and you are ready.

Programs to use for translation

Recommended PO file editors are (in no particular order):

  • XEmacs (with po-mode): runs on Unices with X
  • GNU Emacs (with po-mode): runs on Unices and Windows
  • KBabel: runs on KDE 3
  • Lokalize: The replacement of Kbabel for KDE4.
  • poEdit: Linux, MacOSX, and Windows
    poEdit does support multiple plural forms since version 1.3..
  • OmegaT is another translation tool that can translate PO files. It is written in Java so it is available for multiple platforms (including GNU/Linux and Windows). It can be downloaded from SourceForge.
  • For Mac OS X there is AquaEmacs and a port of GNU Emacs available using carbon for OS X. Also see the Emacs wiki for more usage help and tips. po-mode is not included, but is easy to add. Get it from the GNU gettext distribution.
  • GNU Gettext (Linux/Unix) used for the GNU Translation Project. Gettext also provides msgmerge that makes merging translations easy.
  • Vim (Linux/Unix and Windows versions available) with PO ftplugin for easier editing of GNU gettext PO files.
  • LocFactory Editor (OS X).
  • gted is an eclipse plugin that turns eclipse into a gettext editor. Eclipse is written in Java, so this editor is platform independent.

Be sure to get a recent version for all editors, multiple plural forms are a recent addition to the gettext standard.