I18N - Translating Fan Missions

From The DarkMod Wiki
(Redirected from I18N - Translating FMs)
Jump to navigationJump to search

Introduction

Important: Use I18N.pl to prepare an FM before you attempt to translate it!

Translation

darkmod.txt

Important: Due to bug #3012 it is not yet possible to translate darkmod.txt no README.txt - so please ignore this section for now.

If you translate strings in darkmod.txt, DO NOT translate the field names like Author:, Required TDM Version: etc. These must stay in English, or TDM will not be able to interpret them. Only translate the text that comes after them! If you use I18N.pl, this will be automatically done for you, you should not edit darkmod.txt in this case!

If you want to add your name as translator to the credits, include it in a README.txt file inside YOURFM_l10n.pk4 file.

FM Specific Dictionaries

These dictionaries live in the directory strings/fm/ and must follow a specific format, explained below. The name for such a dictionary is always LANGUAGE.lang, f.i. "english.lang".

The string IDs for FMs are 20000 … 89999, using these ensures that they do not conflict with strings from the TDM core. Note that if you have a string that matches one of the other core strings (like "Silver Key", "#str_10000"), then you should use just the core string ID. This saves the translators from having to translate the string again.

You MUST also separate them from the rest of your FM into their own package called "YOURFM_l10n.pk4" where YOURFM is the name of your original PK4 file. This ensures that TDM can install/update the I18N package properly.

Let's see how this looks for the FM named Outpost, which provides two translations (English and French):

 outpost.pk4:

  xdata/outpost.xd
  maps/outpost.map
  maps/outpost.cm
  maps/outpost.proc
  maps/outpost.script
  maps/outpost.aas32
  strings/fm/english.lang         // include a copy of this, so the FM package
                                  // also works stand-alone

 outpost_l10n.pk4:

  strings/fm/english.lang
  strings/fm/french.lang
  README.txt                      // f.i. with credits for translators

Note that all files names should be in lowercase, otherwise there can be problems under Linux.

Example dictionary, note the entire content is wrapped in "{ }"

// String table english (iso-8859-1) for: The Outpost

// This file was generated automatically on 2011-08-20 13:56 UTC by i18n.pl v0.02
{
  "#str_20000"  "The Outpost"
  "#str_20001"  "Break into a builder outpost to retrieve a gold ingot."
  "#str_20002"  "Gold Ingot"
  "#str_20003"  "Leave the outpost after your main objectives are done and get back to the front gates."
  "#str_20004"  "You won't find bags full of money in a builder outpost, but take away any valuables you can get hold of. Find valuables worth at least 600."
  "#str_20005"  "You won't find bags full of money in a builder outpost, but take away any valuables you can get hold of. Find valuables worth at least 700."
  "#str_20006"  "No knock outs too."
  "#str_20007"  "Killing is not your style. No corpses tonight."
  "#str_20008"  "You won't find bags full of money in a builder outpost, but take away any valuables you can get hold of. Find valuables worth at least 800."
  "#str_20009"  "The massive gold ingot should be worth a fair amount of money. Find out where the ingot is kept and change its ownership."
}

This setup makes it easier to translate the FM, because a translator needs only to copy english.lang to german.lang, change the strings, repackage the outpost_l10n.pk4 file, and it works!

Images with Text

If the text is painted on the image itself, you first need to paint a different image with the text in the foreign language. If you cannot do this yourself, ask one of the translators.

Then it depends on where the image is used. If it is used inside a GUI, you can set it up so that different material shaders are used depending on the language, and each material shader can use the right image for the appropriate language.

Note: If the image is used as f.i. wall texture, then you need to use a similiar technique.

First, create a file named materials/yourfmname.mtr. Here is an example from Thief's Den used for the ingame map in the inventory:

// blends in-game map details onto background parchment
thiefsdenmap
{
        {
                blend filter
                map guis/assets/maps/thiefsdenmap
        }
}

// italien map
thiefsdenmap_it
{
        {
                blend filter
                map guis/assets/maps/thiefsdenmap_it
        }
}

Only English and Italian are shown here, you need one version for each language.

You also need the actual images, in this case:

  • dds/guis/assets/maps/thiefsdenmap_it.dds (Italian version, should go into "yourfm_l10n.pk4" as the other languages)
  • dds/guis/assets/maps/thiefsdenmap.dds (English original, should go into "yourfm.pk4")

Then modify the GUI file (in this case guis/thiefsdenmap.gui) where the map is used to say:

windowDef Desktop {
    rect      0, 0, 640, 480
    nocursor 1
    windowDef background_map {
        rect      100, -10, 440, 480
        background "guis/assets/readables/oldparchment_landscape"
        visible 1
        windowDef actual_map {
            rect      33, 70, 400, 340
            background "thiefsdenmap" // shader of the map
            visible 1
        }
    }
}

and replace the red line with:

           background "#str_20100" // shader of the map

The number (20100) here is an example, use a free number that is not already used in your fm/strings/english.lang file!

In the fm/strings/english.lang file, add the following line:

"#str_20100" "thiefsdenmap"

This will use this shader to display the map. Then, in the fm/strings/italian.lang file, add this line:

"#str_20100" "thiefsdenmap_it"

This means in Italian, the other shader is used.

The map should now display correctly in both languages.

Please note that non-existing strings will default to English. So in any other language, the English map will be used as fallback.

In case this still all unclear, use these files as an example:

  1. http://www.bloodgate.com/mirrors/tdm/pub/pk4/i18n/thiefs_den.pk4
  2. http://www.bloodgate.com/mirrors/tdm/pub/pk4/i18n/thiefs_den_l10n.pk4

Publishing the FM

If you upload your FM somewhere, you need to upload both files, the .PK4 and the *_l10n.pk4. The interface for publishing an FM on thedarkmod.com has a special field where you can enter the URL for the *_l10n.pk4 file.


See Also

Translation resources

Overview of translations

Translation discussions