Donations
Help us to pay our Server!
(: Consider a donation :)
Donation pic
Donators
Main Menu
Language
Recent changes

[Main Page]

Translating

From Widelands.org

Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki mode

Printable version | Disclaimers | Privacy policy

Contents

Translating widelands

The basics for widelands locales

Widelands is using the GNU gettext package for translations. This has the advantage that we have portable translations which work easily out of the box on a lot of systems. It means also, that translations are not terribly easy to do. Read on.

Gettext uses a catalog system. Each and every translatable string in the source files (may it be source code or configuration files of tribes, worlds or maps) are tagged and listed in a file with file ending .pot. The name of the file is determinded from where it comes from, gettext slang for this is textdomain. Widelands defines the following text domains:

maps
Names and description of maps
texts
License and miscellaneous texts
widelands
The executeable including editor
tribes/*
One for each tribe
worlds/*
One for each world
campaigns/*
One for each campaign

So the domain.pot file is generated automatically. This file is then usually copied to <lang_shortcut>/domain.po (note: not .pot but .po). Lang shortcut is usually something like de_DE or fr_BE. Then one edits this .po file, adding file encoding (which should always be utf-8) and translating the msgid string by string to msgstr lines, finally saving the file. Then the files are compiled, generating the machine-readable locales to use.

Helping out with a translation

If you want to help out with translation in a language, which translation still is in progress contact the person you think is responsible for this particular translation, this should help you getting things set up. If you cannot find out who is responsible for this translation contact the elder of translations (Azagtoth). Generally you should just run the script as described in the next paragraph and edit the according .po file, then run the script again.


Translation process

New translation

To add a new translation to the game, you need to obtain an up-to-date copy of the game via SVN and edit the file src/languages.h. Add your language name (in your local language) and language code as you find are the others. Besides adding your language, the #define NR_LANGUAGES in that file must be increased by one. Note that this file MUST be saved with utf-8 encoding. Create a new directory po/<lang> by calling the script utils/buildcat.py <lang>. For example $ utils/buildcat.py de_DE. This creates a first set of files with messages to translate. Recompile the game.

Updates to existing translations

From now on, the process is the same if you're creating a new translation, or updating an existing one. Start by updating your source tree with the newest svn release.

Translate the files under the directory for your language with your favorite editor (e.g. vim po/de_DE/widelands.po or see below for advice on editors).

During your translation work, you can test your localized messages in-game at any time, just go to widelands source base directory and run $ utils/buildlocale.py <lang>. If everything went OK, you should see the messages you translated ingame. You have to configure the game to display messages in your language of course. This can be done with the ingame options menu. You Operating System has to support the locale as well. See its documentation if you have trouble or ask.

Notes

  • Please announce your work on a new translation in the forum or even better, on the mailing list, so that there is no doubled translation :-)
  • Best is to use current SVN to translate since strings are added and removed all the time.
  • If you are unable to run the scripts (because you can't use python or the gettext programs, for example), contact Azagtoth, and I'll send you a <lang> subdir that you could use.
  • Keep full headers to po files. See below for an example file header.
  • Do not forget to insert your utf-8 file encoding into the header of the po file.
  • Do not forget to actually SAVE your files in the correct encoding.

Gettext informations

Gettext translation tools

There are several tools to work with .po files:

  • KBabel (Unix KDE)
  • GTranslator (Unix Gnome)
  • poEdit (Multiplatform)
  • Emacs with po-mode (Multiplatform)
  • Vim with PO plug-in (Multiplatform)


Gettext Terms

textdomain
The part of the package the text belongs to
fuzzy string
This string has been changed by the content creator and is maybe no longer correctly translated.


Example .po file header

# Widelands FILENAME.po
# Copyright (C) 2005-2007 Widelands Development Team
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: Widelands (svnrev)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: YYYY-MM-DD hh:mm+0000\n"
"PO-Revision-Date: YYYY-MM-DD hh:mm+0000\n"
"Last-Translator: YOUR NAME <EMAIL@ADDRESS>\n"
"Language-Team: Language <widelands-public@lists.sourceforge.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

The .pot files are generated in this style. So there is not much to be done. You find the placeholders that you would update for new .po files. Some others are to be updated on each change. The Language-Team: header is meant as default. Change it if you like.

Need help?

If you have a problem with localisation and you can't fix it, contact Azagtoth

Retrieved from "http://xoops.widelands.org/modules/mediawiki/index.php/Translating"

This page has been accessed 5,949 times. This page was last modified 22:14, 9 September 2007. Content is available under GNU General Public License 2.





Search


Login
Username:

Password:


Lost Password?

Register now!
Polls
Which requires the fewest improvements
Animations in game (buildings, workers, nature, animals)
Graphics in main menu
Campaigns (as well as number of campaigns)
Network support
Sounds
Music
Structure of the economies of the tribes
Maps
The transportation system
In game user interface
The editor
Hosted by