Translation
Table of Contents
This is a quick guide to translating Warzone 2100 into other languages. There's a Translation Windows Howto, but be sure to read this page as well, since the howto doesn't cover everything mentioned here. You will also want to read through Translation/Mac as well. Be sure to check 4418 to see if someone is working on your language already, and contact them if you want to help. 3023 is a discussion thread about general translation issues.
The current status of translations.
Please note that translations that fall below ~80% will be disabled. New translations will be enabled below that, as long as updates are coming.
Introduction
Translating Warzone is done by editing a so-called .po file that contains all the messages that would appear on screen if you were playing the game.
There are two main parts to the file: The English message that would appear on screen, and the message in the foreign language that you are trying to translate to. The file also contains the source file with line number where each string is used (to help in deciding on how to translate it).
Getting started
To start translating, download the latest version of the translation file from the current release branch (3.1). The files are named according to the common two letter abbreviation for the language (fr for French, de for German, etc.), and the extension .po. If your language doesn't exist yet (translations below a certain amount are disabled and don't appear in the options, make sure you have a look at the existing files first), please don't reuse an existing .po file, but this empty template.
When you start working on a translation, please announce it in 4418, so others know who is currently working on what.
If you're unsure about a translation leave it empty, only put the original text there if the translation actually is the same.
If you work on an existing translation, some strings may be marked as fuzzy ("#,fuzzy"). That means the original string changed and the translation needs to be checked, it keeps the old translations for reference. Strings marked as fuzzy are not used in the game, you need to fix the translation, or at least remove the fuzzy attribute if the change didn't change the meaning (typo fixes etc.).
The easiest way to edit the files is Poedit (for Windows/Mac OS/Linux), that was made especially for editing translations and makes sure the files are in the right format. Editing by hand is not recommended, because then errors like missing quotes or tokens are not detected.
String length limits
Currently, the total string length for unit names cannot exceed 60 bytes. If it does, it will be cut off. Increasing this limit would require breaking savegames, so for now make sure your translations stay below this limit.
Tokens
When you come across symbols such as %u or %s, leave them in the translation. These are called tokens, and they allow the game to insert more information into the message.
Types of tokens:
%u - unsigned integer, i.e. 10 %i - (signed) integer, i.e. -10 %f - floating point number, i.e. 10.64 %s - string, i.e. "hello"
For more information about the tokens (and the translation process in general), see the gettext manual, section 4.6 deals with reordering the tokens (if you can't find a good translation with them in the original order).
Example
#: src/multigifts.c:297 #, c-format msgid "%s Gives You Technology Documents" msgstr "%s gibt Ihnen Technologiedokumente"
%s is a string (think of it as a string of letters). In this case, it is a username, i.e. "General_Patton". If "General_Patton" would transfer technology documents to someone, a german player would see it as "General_Patton gibt Ihnen Technologiedokumente", while an english player would get to read "General_Patton Gives You Technology Documents".
Getting your changes published
When you are finished, or when you have made some progress and wish to stop for the time being, send the po file back to be included in the game (patches or mo files are both more work to apply, please don't use those). This can be done in a few ways:
- Preferred: Open a new ticket and attach it to that
- Post it in the forums as an attachment
- email it to warzone-dev at gna dot org
For a new language, please include the translated language name for the options menu in your message.
Make sure you are adding to the latest translation file, so that you aren't duplicating work that other people have already done. So after your changes got committed (or when there was a bigger amount of time between you last downloaded the translation file), you should redownload the file. Note that you don't need to wait with updates for us to commit your file, you can just post a newer file with more translations and we'll use the latest one.
Keeping translations up to date
The original strings in the source code change with time, which requires updating the translations. From time to time we commit updated translation files to the repository (usually as "Updated translations"). On Linux, you can do the update yourself by running "make -Cpo update-po", else redownload the translation file (https://github.com/Warzone2100/warzone2100/tree/3.1/po/). When you click there on a file, there's a "history" link (e.g. https://github.com/Warzone2100/warzone2100/commits/3.1/po/de.po) that shows its updates.
Updating translations in other branches
With the above procedure, you'll have the current stable branch (3.1) translated. The development branch will probably have some more strings that need to be translated as well, though most are the same as in 3.1. When you're finished with the 3.1 translation, you can download the po file from https://github.com/Warzone2100/warzone2100/tree/master/po/ and translate the remaining strings, then post it in a ticket, with a note that it is for master.
Attachments
-
po-remove-untranslated.py
(185 bytes) -
added by cybersphinx 22 months ago.
A little python script to remove translations equal to the original string.
-
po-cleanup.py
(615 bytes) -
added by cybersphinx 10 months ago.
Hardcore version of py-remove-untranslated.py, also removes all fuzzy translations, and all similar to the original string (based on the ratio of Levenshtein distance to string length).
