[edit] Translating widelands[edit] The basics for widelands localesWidelands 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:
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. [edit] Helping out with a translationIf 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.
[edit] Translation process[edit] New translationTo 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. [edit] Updates to existing translationsFrom 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. [edit] Notes
[edit] Gettext informations[edit] Gettext translation toolsThere are several tools to work with .po files:
[edit] Gettext Terms
[edit] Example .po file header# Widelands FILENAME.po 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. [edit] Need help?If you have a problem with localisation and you can't fix it, contact Azagtoth |
![[Main Page]](/modules/mediawiki/images/mediawiki.png)
Translating
From Widelands.org
Main Page | Recent changes | Edit this page | Page history | Switch to MediaWiki modePrintable version | Disclaimers | Privacy policy
