I18N.pl: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Tels (talk | contribs)
add example
redo Perl download link step - direct download link didn't work for some reason. Also specify the file name you need to download.
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Introduction ==
== 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.
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 ==
== Requirements ==


* Perl. For Windows, use [http://strawberryperl.com/ Strawberry Perl].
* Perl. For Windows, use [http://strawberryperl.com/ Strawberry Perl].
* The script and a few modules, bundled together at [http://bloodgate.com/mirrors/tdm/pub/scripts Bloodgate].
* The script from [http://bloodgate.com/mirrors/tdm/pub/scripts/ Bloodgate].
* The language files under '''<tt>strings/*.lang</tt>'''


== Usage ==
== Usage ==


On a console (a "DOS Window" under Windows):
In the following examples we will use ''myfm'' in place of your FM name:
 
=== Windows ===
 
* Install Perl from [http://strawberryperl.com/ Strawberry Perl]. You may need to reboot
* Download '''I18N_script.zip''' from [http://bloodgate.com/mirrors/tdm/pub/scripts/ here].
* Extract the contents of this file to somewhere, f.i. <tt>'''C:\'''</tt>, 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 [http://www.computerhope.com/issues/chdos.htm 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:


<pre>
<pre>
perl fm_translate.pl --english fms/outpost/outpost.pk4 --french fms/avant_poste.pk4
C:\I18N\I18N.pl\output\myfm.pk4
C:\I18N\I18N.pl\output\myfm_l10n.pk4
</pre>
</pre>
=== Linux ===
* Install Perl (it is probably already installed)
* Download '''I18N_script.zip''' from [http://bloodgate.com/mirrors/tdm/pub/scripts/ here].
* Extract the contents of this file to somewhere, f.i. <tt>'''/home/yourusernamehere/'''</tt>, 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 '''<tt>myfm.pk4</tt>''')
* If you have other versions of your FM in a different language, copy them there, too. For instance if you have a file named <tt>'''myfm_italian.pk4'''</tt> 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:
The output packages will be created under output, as:


<pre>
<pre>
output/outpost.pk4
./output/myfm.pk4
output/outpost_i18n.pk4
./output/myfm_l10n.pk4
</pre>
</pre>


=== The FM dictionaries ===
== 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 '''[[I18N - Translating Fan Missions|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.
 
{{infobox|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 [http://bugs.thedarkmod.com/view.php?id=3012 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 [[I18N - Translating Fan Missions|Translating Fan Missions]].


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/'''.
=== Who can do the translation? ===


See '''[[Internationalization#FM_specific_dictionaries|here]]''' for examples and how to translate these files.
Anybody who wants to. There is a [[I18N_-_List_of_TDM_translators|list of translators]], these people might be able to help you.


== See also ==
== See also ==


* [[Internationalization]] - Main article
* [[Internationalization]] - Main article
* [[I18N - Translating Fan Missions|Translating Fan Missions]]
* [http://strawberryperl.com/ Strawberry Perl].
* [http://strawberryperl.com/ Strawberry Perl].
* [http://bloodgate.com/mirrors/tdm/pub/scripts The script itself]
* [http://bloodgate.com/mirrors/tdm/pub/scripts/I18N_script.zip The script itself]


{{editing}}
{{editing}}

Latest revision as of 09:16, 9 September 2022

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 I18N_script.zip from here.
  • 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 I18N_script.zip from here.
  • 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