I18N.pl: Difference between revisions
m typos |
redo Perl download link step - direct download link didn't work for some reason. Also specify the file name you need to download. |
||
(3 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
== Usage == | == Usage == | ||
In the following examples we will use ''myfm'' in place of your FM name: | |||
=== Windows === | === Windows === | ||
* Install Perl from [http://strawberryperl.com/ Strawberry Perl]. You may need to reboot | * Install Perl from [http://strawberryperl.com/ Strawberry Perl]. You may need to reboot | ||
* Download | * 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 | * 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") | * 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. | * 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. | ||
Line 21: | Line 23: | ||
* Navigate to the directory you have uncompressed the script to, e.g. by typing | * Navigate to the directory you have uncompressed the script to, e.g. by typing | ||
chdir c:\I18N | chdir c:\I18N\I18N.pl | ||
* Run the script (we assume here you have only the english version:) | * Run the script (we assume here you have only the english version:) | ||
Line 30: | Line 32: | ||
<pre> | <pre> | ||
C:\I18N\output\myfm.pk4 | C:\I18N\I18N.pl\output\myfm.pk4 | ||
C:\I18N\output\myfm_l10n.pk4 | C:\I18N\I18N.pl\output\myfm_l10n.pk4 | ||
</pre> | </pre> | ||
Line 37: | Line 39: | ||
* Install Perl (it is probably already installed) | * Install Perl (it is probably already installed) | ||
* Download | * 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. | * 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>''') | * Open this directory in your favourite file manager, and copy your FM's PK4 file to it (for example '''<tt>myfm.pk4</tt>''') | ||
Line 44: | Line 46: | ||
* Navigate to the directory you have uncompressed the script to, e.g. by typing | * Navigate to the directory you have uncompressed the script to, e.g. by typing | ||
cd ~/I18N | cd ~/I18N/I18N.pl | ||
* Run the script (we assume here you have only the english version:) | * Run the script (we assume here you have only the english version:) | ||
Line 53: | Line 55: | ||
<pre> | <pre> | ||
output/myfm.pk4 | ./output/myfm.pk4 | ||
output/myfm_l10n.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 | 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. | See '''[[I18N - Translating Fan Missions|here]]''' for examples and how to translate these files. | ||
== Bugs == | == 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: | 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: | ||
Line 76: | Line 80: | ||
{{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.}} | {{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 == | == FAQ == |
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
- Perl. For Windows, use Strawberry Perl.
- The script from Bloodgate.
- The language files under strings/*.lang
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.
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
- Internationalization - Main article
- Translating Fan Missions
- Strawberry Perl.
- The script itself