I18N.pl
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
- Perl. For Windows, use Strawberry Perl.
- The script from Bloodgate.
- The language files under strings/*.lang
Usage
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 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 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
- 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\output\myfm.pk4 C:\I18N\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
- 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 temlates like "#str_20000" and place these in a FM-specific dictionary. These dictionaries are put into a sep. PK4 file under the directory strings/fm/.
See here for examples and how to translate these files.
Bugs
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.
See also
- Internationalization - Main article
- Translating Fan Missions
- Strawberry Perl.
- The script itself