Wednesday, 29 July 2015

Translating Mikoto.exe to English

The English language version of Mikoto available in this post [link] is only partially translated.

Some dialogs still contain Japanese text which is displayed as Mojibake.

mojibake

In this post we will endeavour to translate some of these dialogs to English.

One way to translate a program is to open the exe or dll files in a Resource Editor and modify the text if the Japanese text we wish to translate appears in the strings section of the exe or dll or as a label in the user interface.

A word or line of text is known as a string.

resource editor

In this case we will use a hex editor to translate the text.

Warning: Changing an exe or dll file with a hex editor can corrupt a program and stop it working properly so always ensure you have a backup copy of the exe or dll you modify.

The hex editor we will use is MadEdit [link] since this editor has the ability to display the file data as Shift-JIS characters. Shift-JIS is a widely used character encoding used in Japan.

Note that in the Mikoto download some dll files in the Plugins folder are duplicated in the root folder. Be sure to modify the ones in the Plugins folder because these are the ones actually used by the program.

We will look for untranslated strings in Mikoto.exe and the various dll files it uses.

When replacing a string we must ensure that the number of bytes of the new string is not longer than the original Japanese string and that the string ends with a null byte (0x00). When replacing a string be sure to overwite the existing by having the hex editor in overwrite mode and not insert mode.

When an untranslated dialog appears, press Control+C keys to copy the text to the clipboard and then paste it into an new text document you have open.

We will search for this text in MadEdit.

Open Plugins\MotCnv.dll in MadEdit and goto the Search>Find menu item.

Copy a line from the text file into the search box and click Find Next to hopefully go to the text.

Search for text

Text found

At the moment the text is Mojibake because it has being decoded to the incorrect character set.
Go to View>Encoding and select Shift-JIS to display the Japanese text.

Change encoding to Shift-jis

The Japanese text

Now we have some Japanese text we can copy into an online translator.

Note that the text contains the byte 0x0A which is the carriage return character so the text occupies several lines. We will need to ensure the 0x0A bytes remain where they are if possible.

The end of the text is the first occurrence of 0x00 after all the Japanese characters.

Make sure the text you copy into the online translator contains no 0x00 bytes.

Translate the text online

Next we need to overwrite the text with the translation making sure that the0x0A and 0x00 bytes remain where they are. Note if the translation occupies fewer bytes, add spaces until the 0x00 byte at the end of the text.

In the screenshots above you will see that the dll was read only in MadEdit because I had Mikoto running. I closed Mikoto and opened Plugins\MotCnv again so I could write the translated text.

Translation

Save the modified dll, overwriting the original, and check that the translated dialog now appears.

Translated dialog



No comments:

Post a Comment