I18N.pl

From The DarkMod Wiki
Revision as of 09:32, 7 July 2012 by Tels (talk | contribs) (update after coments by grayman)
Jump to navigationJump to search

Introduction

The script fm_translate.pl separates the main FM data from all the texts and other assets that need to be changed in order for translation. It can either transform an English FM, or match an English FM to other languages.

Requirements

Usage

In the following examples we will use myfm in place of your FM name:

Windows

  • Install Perl from Strawberry Perl. You may need to reboot
  • Download this ZIP file: [1]
  • Extract the contents of this file to somewhere, f.i. C:\, so that you now have there an I18N directory with a directory I18N.pl in it. The text below assumes you have choosen that path. If not, replace it everywhere it occurs.
  • Open this directory in Explorer, and copy your FM's PK4 file to it (for example "myfm.pk4")
  • If you have other versions of your FM in a different language, copy them there, too. For instance if you have a file named "myfm_italian.pk4" which is the same version of your FM, but in Italian, then copy it there, too.
  • Open a console aka a "DOS Window" (see here if you do not know how to do this)
  • Navigate to the directory you have uncompressed the script to, e.g. by typing
chdir c:\I18N\I18N.pl
  • Run the script (we assume here you have only the english version:)
perl I18N.pl --english myfm.pk4

The output packages will be created under output, as:

C:\I18N\I18N.pl\output\myfm.pk4
C:\I18N\I18N.pl\output\myfm_l10n.pk4

Linux

  • Install Perl (it is probably already installed)
  • Download this ZIP file: [2]
  • Extract the contents of this file to somewhere, f.i. /home/yourusernamehere/, so that you now have there an I18N directory with a file I18N.pl in it. The text below assumes you have choosen that path. If not, replace it everywhere it occurs.
  • Open this directory in your favourite file manager, and copy your FM's PK4 file to it (for example myfm.pk4)
  • If you have other versions of your FM in a different language, copy them there, too. For instance if you have a file named myfm_italian.pk4 which is the same version of your FM, but in Italian, then copy it there, too.
  • Open a console
  • Navigate to the directory you have uncompressed the script to, e.g. by typing
cd ~/I18N/I18N.pl
  • Run the script (we assume here you have only the english version:)
perl I18N.pl --english myfm.pk4

The output packages will be created under output, as:

./output/myfm.pk4
./output/myfm_l10n.pk4

The FM dictionaries

Once the script is finished, it will replace as much hard-coded strings like "Silver Key" with string templates like "#str_20000" and place these in a FM-specific dictionary. These dictionaries are put into a sep. PK4 file (named myfm_l10n.pk4), they can be found inside this file under the directory strings/fm/.

See here for examples and how to translate these files.

Bugs

GUI files

Currently GUI files are not parsed, and thus their strings not entered into the FM dictionary. Mainly this means you need to manually edit guis/maps/FMNAME.gui and replace things like:

text   "Mission Loading"

with

text   "#str_02236"       // Mission Loading

If there are other texts in it, like "Loading finished", and these cannot be found in strings/all.lang in the TDM core, then you need to use numbers above 20000 (best use 20100 and above) and then also add the strings into the strings/fm/english.lang etc. file.

Also note that the main PK4 file should always contain a copy of the strings/fm/english.lang file, so that people who do not have the _l10n.pk4 file can still play the FM.

README.txt and darkmod.txt

Due to bug #3012 README.txt and darkmod.txt cannot yet be translated.

FAQ

Do I need different languages of my FM?

No, the script can also just use the English version. But the English version is mandatory, you cannot just use a French FM!

How must the PK4 files be named?

The names can be anything, they are not important.

Do I need to increase the version of my FM?

The FM database on thedarkmod.com uses an arbitrary integer to denote the current version, everytime this is incremented, users which have the same FM with a lesser number get asked to upgrade it.

However, it is a wise idea to increase the version in your README, too, because that is the one that users will refer to when talking about your FM.

My mission has image files with text on it. How do I translate them?

See this article Translating Fan Missions.

Who can do the translation?

Anybody who wants to. There is a list of translators, these people might be able to help you.

See also