What's new

Translation tool for RPG Maker XP/VX/VX Ace


perost

Jungle Girl
Joined
Sep 13, 2013
Messages
47
Reputation score
30
Hey guys,

I've written a small translation tool for RPG Maker XP/VX/VX Ace for myself, and thought I'd share it here in case someone else finds it useful. It works by dumping the data files as JSON, which can then be translated and applied to the data files. The tool is also capable of updating the translation files in case the data files change, for example when a new version of a game is released.

I originally just made it for VX, but then realised that I'd already done all the hard work and might as well make it compatible with VX Ace too. Most of my testing has been done with VX though.

The tool is unfortunately written in Ruby, since that makes it trivial to parse the data files (RPG Maker uses Ruby marshalling). I say unfortunately since this means you need to install a Ruby interpretor to use the tool. I have also only tested it on Linux using Ruby 2.1.5, although I've tried to keep it as platform independent as possible. I only started to learn Ruby last week though, so there's likely to be issues. Let me know if you find any :)

The tool can be downloaded here (just download the whole folder): http://mega.co.nz/#F!XMYFQbZY!0saZjkHOXa43GR3m8BJEMg

Update: Now also for XP!

Here's the README for the tool, it should hopefully explain everything you need to know:
*** What is this? ***
This is a translation tool for RPG Maker XP/VX/VX Ace (rmxp_translator.rb for
XP, rmvx_translator.rb for VX and rmvxace_translator.rb for VX Ace). It can be
used to dump the data files for a game to JSON, which can then be translated
and applied to the data files to translate the game. The tool is also capable
of updating the translation files if the data files are changed.

*** What do I need to use the tool? ***
The tool is written in Ruby, because that makes it very easy to parse the RPG
Maker data files (which are in Ruby marshal format). This means that you need
a Ruby interpretor, see https://www.ruby-lang.org.

*** Do I need RPG Maker to use the tool? ***
No, there's no need to have RPG Maker installed, the tool just parses and
translates the data files. It might be useful to have RPG Maker, or at least
some knowledge of how RPG Maker works, to better understand the translation
files, but it's not required in any way.

*** How do I use it to translate a game? ***
First of all you need to make sure that you have access to the data files for
the game you wish to translate. Many games are encrypted, and the data files
are contained in either Game.rgssad for XP, Game.rgss2a for VX or Game.rgss3a
for VX Ace. In that case you need to decrypt this file and extract the data
files. There are multiple tools on the internet that can do this. When you've
decrypted the data files you should have a Data directory containing .rxdata
files for XP, .rvdata for VX or .rvdata2 for VX Ace. You should then remove
Game.rgssad/Game.rgss2a/Game.rgss3a, to avoid it being loaded instead of the
decrypted data files.

The next step is to create a new directory for the translation, and copy all
the data files into that directory. These data files are now the control files
used to check that the translation is ok. Then use the tool to dump the
translation data to JSON files (all examples are for VX, for XP/VX Ace just
change the commands as appropriate):

ruby rmvx_translator.rb --dump=*.rvdata

--dump takes a file pattern as argument, so *.rvdata will match all *.rvdata
files. You can also dump a single file by using its name, or whatever pattern
you wish (it's using Ruby's Pathname.glob). This will create a number of .json
files alongside the control data files. You will get a warning for each .json
file that already exists, to avoid overwriting a translation by mistake. There
is also a --dest flag for setting the destination of the generated files that
works with all commands, but it's not so useful for --dump since the .json
files need to be in the same directory as the files they're created from.

The next step is to translate the .json files. For this you just need a text
editor that can open and save files using UTF-8 encoding. Something like
Notepad++ should probably do the trick. The files use the JSON format, and the
structure varies depending on what data they contain. The thing to look out
for is entries for TranslatableString and TranslatableArray, that for example
looks like this for an Actor:
Code:
    {
      "json_class": "RPG::Actor",
      "name": {
        "json_class": "TranslatableString",
        "original   ": "レリカ",
        "translation": ""
      }
    }
Simply insert the translation where it says translation, like this:
Code:
    {
      "json_class": "RPG::Actor",
      "name": {
        "json_class": "TranslatableString",
        "original   ": "レリカ",
        "translation": "Rerika"
      }
    }
TranslatableArray:s are used for shown text, scripts and comments, and
can represent multiple lines of text:
Code:
    {
      "json_class": "TranslatableArray",
      "original   ": [
        "some text",
        "some more text",
        "even more text"
      ],
      "translation": [
        "translated text",
        "more translated text",
      ]
    }
As shown in the example above the number of lines in the translation does not
need to match the number of lines in the original text, to account for
translations that might be longer or shorter than the translated text.

When you've translated something and wish to apply the translation to the
game, use the --translate flag and set the destination to be the game's data
directory (note that you should still use .rxdata/.rvdata/.rvdata2, not json):

ruby rmvx_translator.rb --translate=*.rvdata --dump=<Insert game dir here>

The tool will then load each data files that matches the pattern, and look for
a .json file containing a translation in the same directory (any files that
don't have a translation file will be ignored). It will then translate the
data using the translation file and dump the translated data files in the
destination directory.

While translating it will check that the original string for each
TranslateString entry matches the string in the loaded data file, otherwise it
will abort the translation. This is done to make sure that the control data
files haven't changed, since the translation would then be invalid. This is
the reason for having a set of control data files which are not translated,
since a translation can't be applied to an already translated data file (the
tool will warn you if you try to overwrite any control data files). Any
translation strings that are empty will simply be ignored, so it's not
necessary to translate everything.

If you accidentally change the original string instead of the translation
string, or if you change the control data files without updating the
translation, you will get an error like this:
Code:
    Error: Invalid translation element!
      Got translation for:
        Rerika
      Expected:
        レリカ
      Translation:
        
      from element RPG::Actor with index 1
      from element name
This error means that the original string for the name of the first Actor in
the json file was Rerika, but the corresponding string in the control data
file was レリカ, and that the translation string was empty. This likely means
that you've changed the original string instead of the translation string. In
such case you can usually just copy the expected string back into the
original string in the json file.

One thing to look out for when translating is that RPG Maker commands in
strings are escaped by JSON, so e.g.:

"\AL[1]Some text"

will become

"\\AL[1]Some text"

in the translation in the json files. It's important to keep this in mind
when translating, since using only e.g. \AL[1] in the translation will mean
that RPG Maker won't recognize this as a command (it will read it as AL[1]
and display it as such in the text).


*** What about scripts? ***
Scripts are a bit special, since they're not actually stored as RPG Maker data
structures, but are rather compressed ruby scripts. JSON does not allow
newlines in text though, which means that scripts become a single long line if
dumped as JSON. To avoid this the scripts are dumped into separate files, and
Scripts.json contain entries like this which say which file the script is in:
Code:
    {
      "json_class": "Script",
      "filename": "scripts/Script002.rb",
      "name": {
        "json_class": "TranslatableString",
        "original   ": "Vocab",
        "translation": ""
      }
    }
In this case the script can be found in scripts/Script002.rb. The filenames
pointed to by Scripts.json are the control files, while the files ending with
_tran are the translation files. If nothing has been translated, then these
files are identical. To translate a script, say scripts/Script002.rb, simply
open scripts/Script002_tran.rb and make any changes you wish. These changes
will then be applied when translating Scripts.rxdata/rvdata/rvdata2. Unlike the
normal translation strings where an untranslated string is empty, the _tran.rb
files are just copies of the control files.

Take care when translating scripts and only translate strings that you know
are displayed in the game. It's easy to break the game otherwise (but you can
always just replace the translated Scripts data file with the control in that
case).

*** How do I update a translation? ***
If for example a new version of a game is released it will be necessary to
update the translation, since the data files will have changed. Before doing
this it's a good idea to make a backup of the translation files, in case
something goes wrong.

Then replace the control data files with the new data files, and update the
translation files:

ruby rmvx_translator.rb --update=*.rvdata

The tool will then compare the translation data with the new control data, and
it will add/remove anything that has been changed in the control data. If a
string has changed it will remove the translation for that string, since the
translation is no longer valid. A message will be printed out for each
translation that's removed. This means that there's a chance that some parts
of the translation is invalidated and removed, but since most games that are
updated only receive new content or small bug fixes this shouldn't be a big
problem.

If all goes well the translation should now be compatible with the new data
files, and any untranslated strings can be translated and applied.

*** Can I use this to continue translating a game? ***
If a game has been partially translated using RPG Maker it's possible to use
this tool to continue the translation, by just treating it as an untranslated
game and then translating any untranslated strings. There will be issues if
the translation is attempted to be updated to a new version of the game
though, since any string translated in RPG Maker will not match the new data
files and thus have it's translation removed.
 
Last edited:

Strange

Demon Girl Pro
Joined
Jul 24, 2014
Messages
1,256
Reputation score
486
Re: Translation tool for RPG Maker VX/VX Ace

Interesting. Does your script work with RPGMXP's ruby, and rxdata files?

I'm especially interested in how to extract common events, and especially common events text; I am utterly confused with eventcommands, their parameters list, etc. and how all these are scripted in place.

I can adapt my own scripts to output pretty much everything else into .txt of my liking, but common events remain a mystery to me.
 

kvier

Demon Girl Master
Joined
Mar 22, 2012
Messages
315
Reputation score
49
Re: Translation tool for RPG Maker VX/VX Ace

Nicely done!

One annoying thing: mediafire has recently made it a pain to download a folder of files.
 
OP
P

perost

Jungle Girl
Joined
Sep 13, 2013
Messages
47
Reputation score
30
Re: Translation tool for RPG Maker VX/VX Ace

Interesting. Does your script work with RPGMXP's ruby, and rxdata files?

I'm especially interested in how to extract common events, and especially common events text; I am utterly confused with eventcommands, their parameters list, etc. and how all these are scripted in place.

I can adapt my own scripts to output pretty much everything else into .txt of my liking, but common events remain a mystery to me.
No, it doesn't support XP, mostly because I didn't have it installed when I wrote the script. But it should be fairly easy to implement XP support too, it mostly just a matter of copying the data structures from the manual. As for the common events, my tool just has a table with the event codes which decides whether a certain event type might contain text or not, and just dumps all the parameters if it does. If I have some time I'll look into adding XP support, it shouldn't be much work.

Nicely done!

One annoying thing: mediafire has recently made it a pain to download a folder of files.
Thanks, I hadn't noticed that. The only reason I'm using mediafire is because mega was down when I needed an account to upload some files to. I'll see about switching to a better host.
 
OP
P

perost

Jungle Girl
Joined
Sep 13, 2013
Messages
47
Reputation score
30
Re: Translation tool for RPG Maker XP/VX/VX Ace

The tool should now support XP too, and I've moved the files to Mega.
 

HappyGoomba

Sex Demon
Joined
Jul 26, 2012
Messages
258
Reputation score
31
Re: Translation tool for RPG Maker XP/VX/VX Ace

This looks like a bug to me. I'm using the XP translator.

In the event editor, I've got these two Show Text commands, one after the other:




In the first, we've got a character moaning, in the second there's some narration.

In the .json file we have this:
Code:
{
                "json_class": "RPG::EventCommand",
                "type": "Show Text",
                "parameters": [
                  {
                    "json_class": "TranslatableString",
                    "original   ": "【\\N[1]】",
                    "translation": ""
                  }
                ]
              },
              {
                "json_class": "RPG::EventCommand",
                "type": "Show Text More",
                "parameters": [
                  {
                    "json_class": "TranslatableString",
                    "original   ": "「んっ……んっ…ん…あっ…あ…あ……",
                    "translation": ""
                  }
                ]
              },
              {
                "json_class": "RPG::EventCommand",
                "type": "Show Text",
                "parameters": [
                  {
                    "json_class": "TranslatableString",
                    "original   ": " 一度生じた性感は、治まる気配を全く見せず、",
                    "translation": ""
                  }
                ]
              },
              {
                "json_class": "RPG::EventCommand",
                "type": "Show Text More",
                "parameters": [
                  {
                    "json_class": "TranslatableString",
                    "original   ": "時間を経る毎にますます増幅していって、私の",
                    "translation": ""
                  }
                ]
              },
              {
                "json_class": "RPG::EventCommand",
                "type": "Show Text More",
                "parameters": [
                  {
                    "json_class": "TranslatableString",
                    "original   ": "身体を支配し始めていた。",
                    "translation": ""
                  }
                ]
              },

It's split each command into individual lines, I'd have to reassemble them to run them through a translator. It looks like this may be an artifact of how XP saves it's text strings.
 

Attachments

OP
P

perost

Jungle Girl
Joined
Sep 13, 2013
Messages
47
Reputation score
30
Re: Translation tool for RPG Maker XP/VX/VX Ace

This looks like a bug to me. I'm using the XP translator.
It's because RPG Maker stores event commands like that. It happens with all kinds of text. That's why it says type: "Show Text" and type: "Show Text More", because the first line of text has a different event code than the other lines. I agree that it's a bit inconvenient. It would of course be possible to make the tool concatenate such things, but then there's also the issue that JSON doesn't allow line breaks in strings. So you'd get all of it on one long line (that's the reason why scripts are dumped to separate files). Maybe putting the text in an array would be a good solution... I'll look into it.
 

HappyGoomba

Sex Demon
Joined
Jul 26, 2012
Messages
258
Reputation score
31
Re: Translation tool for RPG Maker XP/VX/VX Ace

Here's a quick and dirty Powershell script that takes the Show Text and Show Text More commands and concatenates them into usable form in a text file.

The output looks like this:
Show Text:
184,185
【\N[1]】
「んっ……んっ…ん…あっ…あ…あ……



Show Text:
186,187,188
 一度生じた性感は、治まる気配を全く見せず、
時間を経る毎にますます増幅していって、私の
身体を支配し始めていた。


Show Text:
190,191
【\N[1]】
「あっ……あっ…あっ…あっ……



Show Text:
196,197
 アソコを指で苛めながら、男達は私の身体に
舌を這わせてきた。

The numbers are the increments into the array of Event Commands created by reading the JSON file. Now all I need is to write another function that reads the JSON file, reads this file, inserts the translated lines into the 'translation' parameter of the corresponding array elements and writes the altered data structure out to a new JSON file.

However, this points out a potentially severe limitation with the extract-translate-reinsert process. What happens if the translation isn't the same number of lines as the original? As I've been translating, it's not uncommon for 2 lines of Japanese text to become 3 lines of English, or vice versa. Since, in the underlying data structure, each line is a separate data element, we'd need to account for that.

So anyone who wants to try this just download the file and delete the .txt from the end (.ps1 files aren't allowed as attachments.) Then dot-source it and run the Convert-JSONtoText function with the name of the JSON file and the name of the text file to output to. Here's an example:

Code:
PS G:\translator> . .\Transtools.ps1
PS G:\translator> Convert-JSONtoText -inJSONfile .\Map060.json -outTextFile .\map60.txt
 

Attachments

OP
P

perost

Jungle Girl
Joined
Sep 13, 2013
Messages
47
Reputation score
30
Re: Translation tool for RPG Maker XP/VX/VX Ace

However, this points out a potentially severe limitation with the extract-translate-reinsert process. What happens if the translation isn't the same number of lines as the original? As I've been translating, it's not uncommon for 2 lines of Japanese text to become 3 lines of English, or vice versa. Since, in the underlying data structure, each line is a separate data element, we'd need to account for that.
I have updated the tool to merge text, scripts and comments into arrays, so it looks like this now:
Code:
    {
      "json_class": "TranslatableArray",
      "original   ": [
        "some text",
        "some more text",
        "even more text"
      ],
      "translation": [
        "translated text",
        "more translated text",
      ]
    }
As shown in the example the translation no longer needs to have the same number of lines as the translated text, so the translation can now be shorter or longer than the translated text. I guess it's not exactly what you wanted since it still can't be fed directly to a machine translator, but I think it's a big improvement.

The new tool is not backwards compatible with the old format, but I wrote a small script that can be used to update old translation files. Just run all the old .json-files through it and you should be good to go. Get it
 

HappyGoomba

Sex Demon
Joined
Jul 26, 2012
Messages
258
Reputation score
31
Re: Translation tool for RPG Maker XP/VX/VX Ace

I get an error when I try to run the new version against my XP map file

Code:
PS G:\Downloads\translator1\translator> C:\Ruby193\bin\ruby.exe .\rmxp_translator.rb --dump=*.rxdata
Dumping Map060.rxdata... G:/Downloads/translator1/translator/rmxp_db.rb:1092:in `merge_event_commands': undefined method
 `code' for #<RPG::EventCommand:0x1f35138> (NoMethodError)
        from G:/Downloads/translator1/translator/rmxp_db.rb:511:in `to_json'
        from G:/Downloads/translator1/translator/rmxp_db.rb:477:in `to_json'
        from G:/Downloads/translator1/translator/rmxp_db.rb:477:in `to_json'
        from G:/Downloads/translator1/translator/rmxp_db.rb:638:in `to_json'
        from G:/Downloads/translator1/translator/rmxp_db.rb:638:in `to_json'
        from C:/Ruby193/lib/ruby/1.9.1/json/common.rb:278:in `generate'
        from C:/Ruby193/lib/ruby/1.9.1/json/common.rb:278:in `pretty_generate'
        from G:/Downloads/translator1/translator/base_translator.rb:136:in `dump_file'
        from G:/Downloads/translator1/translator/base_translator.rb:79:in `block in dump_files'
        from G:/Downloads/translator1/translator/base_translator.rb:79:in `each'
        from G:/Downloads/translator1/translator/base_translator.rb:79:in `dump_files'
        from G:/Downloads/translator1/translator/base_translator.rb:73:in `block in do_commands'
        from G:/Downloads/translator1/translator/base_translator.rb:73:in `each'
        from G:/Downloads/translator1/translator/base_translator.rb:73:in `do_commands'
        from ./rmxp_translator.rb:6:in `<main>'
 

HappyGoomba

Sex Demon
Joined
Jul 26, 2012
Messages
258
Reputation score
31
Re: Translation tool for RPG Maker XP/VX/VX Ace

Another problem with this utility, everytime I use it, I end up with this running through my head for the next couple of hours:

 
OP
P

perost

Jungle Girl
Joined
Sep 13, 2013
Messages
47
Reputation score
30
Re: Translation tool for RPG Maker XP/VX/VX Ace

I get an error when I try to run the new version against my XP map file
Sorry, didn't test enough. Should be fixed now.


Another problem with this utility, everytime I use it, I end up with this running through my head for the next couple of hours:

That's a feature, not a bug :p
 

nox

Demon Girl
Joined
Sep 18, 2013
Messages
65
Reputation score
2
Re: Translation tool for RPG Maker XP/VX/VX Ace

The next step is to create a new directory for the translation, and copy all
the data files into that directory. These data files are now the control files
used to check that the translation is ok. Then use the tool to dump the
translation data to JSON files (all examples are for VX, for XP/VX Ace just
change the commands as appropriate):

ruby rmvx_translator.rb --dump=*.rvdata

--dump takes a file pattern as argument, so *.rvdata will match all *.rvdata
files. You can also dump a single file by usi....

I found this thread with hopes of translating the games I have, and then was completely lost at the step I quoted above...
 

exanoid

Jungle Girl
Joined
May 21, 2015
Messages
42
Reputation score
5
Re: Translation tool for RPG Maker XP/VX/VX Ace

need more detailed explanation :)
 

Damoriva

Cthulhu
Joined
Feb 11, 2010
Messages
498
Reputation score
53
Re: Translation tool for RPG Maker XP/VX/VX Ace

I found this thread with hopes of translating the games I have, and then was completely lost at the step I quoted above...
need more detailed explanation :)
Apologies for the necro, but I just came across this thread when I decided to try translating some things. I gave up though, because there's no way I'd be able to translate the text in CGs (which is all I wanted to do for one of Marimo's games), but I found out how to run those commands.

Once you've installed Ruby, navigate to wherever you put the rmvxac translation files.

SHIFT+Right Click in the window and select 'Open command window here'.

Then you can type in those commands, minus the 'ruby' at the start.

Hope you have better luck than me.
 

Yugifan3

Tentacle God
Joined
Oct 23, 2013
Messages
1,968
Reputation score
1,057
Re: Translation tool for RPG Maker XP/VX/VX Ace

Right , so can someone help me here.
I have edited the .json file and want to convert it back to a .rvdata file.
What command do i use?
 

kvier

Demon Girl Master
Joined
Mar 22, 2012
Messages
315
Reputation score
49
Re: Translation tool for RPG Maker XP/VX/VX Ace

It does say in the associated README.txt:

When you've translated something and wish to apply the translation to the game, use the --translate flag and set the destination to be the game's data directory (note that you should still use .rxdata/.rvdata/.rvdata2, not json):

ruby rmvx_translator.rb --translate=*.rvdata --dest=<Insert game dir here>

The tool will then load each data files that matches the pattern, and look for a .json file containing a translation in the same directory (any files that don't have a translation file will be ignored). It will then translate the data using the translation file and dump the translated data files in the destination directory.
You may want to use a separate directory for the source rvdata files from the destination ones.


If that command is giving you errors, I think I have a fix.
 

Yugifan3

Tentacle God
Joined
Oct 23, 2013
Messages
1,968
Reputation score
1,057
Re: Translation tool for RPG Maker XP/VX/VX Ace

Right , okay ill explain.
First i converted the Commonevents.rvdata to a json file.
I then edited it.
Now i wanna turn the json file into a rvdata so rpg maker can read it.
So, my question is. Where do i put the files and what command do i use?
Do i put both the original rvdata in one folder with the json file or does it need to be called data folder?
 

kvier

Demon Girl Master
Joined
Mar 22, 2012
Messages
315
Reputation score
49
Re: Translation tool for RPG Maker XP/VX/VX Ace

If you're only translating that single file, I'd do something like:

  • rename the Data directory to "Original Data"
  • duplicate that entire directory into a new directory called "Data"
  • use the translation tool to generate the json; edit the json
  • finally, from a command prompt in the "Original Data" directory, I'd run:

    ruby rmvx_translator.rb --translate=CommonEvents.rvdata --dest=..\Data

And to answer the question ... the translation tool needs to have the original data in place to order to generate the translated version, so you need to keep the original on hand, and the rpgmaker runtime will only look for its data in a directory named Data
 
Last edited:
Top