Translating the game

This page describes how to **translate the game into a different language**.

You can extract all the text in your game and save it in a text file. Then, after translating this text, you can recompile it into your game.

The text that can be extracted is as follows:

* Anything in the scripts (or plugin scripts) that is inside one of the following: `_INTL("text")`, `_ISPRINTF("text")`. This can include filenames, e.g. allowing you to use different graphics for different languages.
* Compiled text taken from the PBS files.
* Any text messages and choice options in events, and anything in event script commands that is inside the following: `_I("text")`.

## Step 1: Extracting the text

Text can be extracted by using the Debug mode function "Extract Text". This will save all the game's text (of the last time that the game is compiled) in a file called "intl.txt" in the game folder.

Translate the text by changing every second line in that file to the translated version of that line.

Note that text which used to be in the scripts but no longer is will still remain in the extracted text file, due to the way in which messages work. Ideally, you should delete the file "messages.dat" from the game's "Data" folder, and then fully compile the game (i.e. hold Ctrl while running it from RPG Maker XP) to ensure only the existing messages are extracted.

Note also that if the exact same message appears multiple times in the same section (e.g. in the scripts, or in one map's events), then that message will only appear once in that section in the extracted text. You will not have to translate the same line in the same section more than once.

## Step 2: Compiling the translated text

To add the translated text back into your game, choose the Debug mode function "Compile Text". This will convert the translated text and save it as the file "intl.dat".

Then rename this file to something else (e.g. "french.dat") and move it to the "Data" folder.

Finally, in the script section **Settings**, edit the array `LANGUAGES` to include both the English line (default) and another line for your new language.

## Bugs and restrictions

* If an event moves the player to another map but then shows a message, the message will be shown while on the new map but the message is actually written in the event on the old map. This means that the message cannot (normally) be translated, because it only checks for translations of messages amongst the current map's messages.
	+ The easiest way around this is to ensure this does not happen. Any messages shown after a map transfer should be displayed by events on the new map.
* If there are any `\n` in the text extracted from the scripts (ignore text extracted from elsewhere), you will need to change them to `<<n>>` in order for them to work properly.
* If you have extracted the scripts into separate files (like the GitHub version of Essentials has done), text extraction will not be able to search those separate files for text. You will need to combine the script files back into Scripts.rxdata before extracting the text.

## Tips

* Translating your game should be the very last thing you do, to avoid spending time on translating text only for it to be changed later.
* You can manually add more line pairs into the extracted text file, or edit existing ones there, rather than extracting all the text again.
* If you're not going to translate a line, you can remove it from the extracted text file. It will not cause a problem; the original text will simply be used instead.