Translations (OpenXcom)

From UFOpaedia
Jump to: navigation, search

Like the original, OpenXcom supports translation of all ingame strings. However, the format has been changed to make it easier to edit, maintain and add support for Unicode. Currently the easiest way to translate is to use the Transifex web site.

Guidelines

  • Preserve the original structure: Don't change text inside {} tags and keep any spaces, uppercases, etc. that the original string has, unless you have a good reason not to.
  • Be consistent: Don't make the text look schizophrenic, stick to one style throughout. If a word has multiple translations, choose one and stick with it. If working with multiple translators, be sure to work this out before-hand. Transifex has handy Glossary tool for that. During translation you will receive highlights for known words.
  • Don't use automatic translations: We're not robots. Only use them to assist you. I recommend Linguee since it uses real translations.
  • Review your work: Again, we're not robots and make mistakes every now and then. Don't forget to use a spellchecker.
  • Pay attention to length: while most of the interface is fairly roomy (eg. Ufopaedia screens), some elements just can't fit a lot of words into a tight 320x200 screen (eg. columned lists). Remember you can test your translation ingame by downloading the file to your Language folder.

Graphics

Sadly a translator's job isn't just replacing strings. Sometimes you also need to have a little bit of artistry. The game uses bitmap fonts to display text, so if your language has new characters that it doesn't support, you'll have to add them in yourself. The font files are PNG images in the Language folder, which are referenced by a Font.dat text file which contains all the characters in the fonts (in UTF-8). To add a character you just put it at the end of the chars: in Font.dat and then draw them into the font files (both lowercase and uppercase).

Testing

To test your translations in-game you just need to put them in the Data\Language folder. You can get the latest translations directly from Transifex by clicking the resource name. They are also available in the Git builds. If you need to check how much room you have for a string, you can enable debugUi in your options.cfg to see the text boxes in-game.

Format

Language files are stored in YAML format (UTF-8). Here's a typical language file:

en-US:
  STR_AVENGER_UFOPEDIA: "TRANSPORTER AND COMBAT SPACECRAFT.  THE ULTIMATE REPLICATION OF ALIEN TECHNOLOGY."
  STR_INTERCEPTOR_UFOPEDIA: "COMBAT AIRCRAFT WITH DUAL PULSE DETONATION ENGINES AND SPECIALLY SHIELDED ELECTRONIC SYSTEMS.  THE BEST AVAILABLE EARTH BASED TECHNOLOGY."
  STR_LIGHTNING_UFOPEDIA: "TRANSPORTER AND COMBAT CRAFT.  A CRUDE BUT EFFECTIVE REPLICATION OF ALIEN PROPULSION SYSTEMS."
  STR_SKYRANGER_UFOPEDIA: "TROOP TRANSPORTER.  THE FASTEST OF ITS KIND, WITH VERTICAL TAKE OFF AND LANDING (V.T.O.L.) CAPABILITY."
  STR_FIRESTORM_UFOPEDIA: "COMBAT CRAFT.  THIS ONE-MAN FIGHTER REPLICATES THE CLASSIC ALIEN FLYING SAUCER DESIGN, WITH CENTRAL PROPULSION UNIT."
  ...

The first line contains the IETF language tag (same as the filename). The rest of the text are just key-string pairs, separated by linebreaks. Language files are placed in the Data\Language folder and have the .yml extension.

Special cases

Pluralization

Some strings have different forms depending on the associated number {N}, for example "1 day" and "2 days". Different languages have different pluralization rules (See Unicode Language Plural Rules for the reference), you can ignore the cases that don't apply to your language as they won't be used by the game. Otherwise you should provide all plural forms, needed for your language.

For example, you translating OpenXcom to Czech. Source en-US.yml for English have these lines:

 STR_DAY:
   one: "{N} day"
   other: "{N} days"

As we can see, English have only 2 plural forms, one and other. But Czech, according to standards, have 3 plural forms: one ("1 den"), few ("2 dny") and other ("5 dní"). So here code how it should look in cz.yml file:

 STR_DAY:
   one: "{N} den"
   few: "{N} dny"
   other: "{N} dní"

OpenXcom engine based on digit, provided here as {N}, will choose correct plural form.

Gender-specific messages

Again, some languages have messages, that differ for male or female character. For example, in Russian we have two variants of "<Soldier name> has Panicked": "<Soldier name> запаниковал" (for male character) and "<Soldier name> запаниковала" (for female character). For this case we have two strings with _MALE and _FEMALE suffixes:

 STR_HAS_PANICKED_MALE: "{0}{NEWLINE}запаниковал"
 STR_HAS_PANICKED_FEMALE: "{0}{NEWLINE}запаниковала"

If your language don't have such feature, just provide for both strings same translation. Otherwise, fill male and female messages accordingly their suffixes.

External Links