Previously I showed how to use TextExtractor to hook a Unity game and a very overly complex way to hook astronauts brand games. But TextExtractor with unity gets a lot of garbage text or sometimes nothing really usable at all.
This time I’ll show better way that should work very consistently with any Unity game with little configuration in two parts.
- How to use XUnity.AutoTranslator to translate unity games
- How to extract the pure untranslated text without translation
If you only want the translated text the first section should be enough.
But if you want the japanese text, either to use TranslatorAggregator and translate using several different translators to compare or like me, to use chiitranslite to display the kanji readings and train japanese, then continue to the second part. It’s a bit more advanced.
There are several ways to do this but I’ll show you using the BeepInEx which is the recommended way.
ReiPatcher is easier to do but it alter a few of the games .dlls so I’ll not use that.
Setting up BeepInEx
You’ll first need to download BeepInEx (BepInEx_x86_188.8.131.52.zip) from here https://github.com/BepInEx/BepInEx/releases/tag/v5.4.5
Please not that you need the arquitecture version(x64, x86) that the game runs on, not you PC arquitecture. Most of the time that’s the x86 version.
Unpack all the files inside the game root folder.
Setting up XUnity.AutoTranslator
Download the BeepInEx version of XUnity(http://xunity.autotranslator-bepin-5x-4.13.0.zip/) from here https://github.com/bbepis/XUnity.AutoTranslator/releases/tag/v4.13.0
Unpack all the files also inside the root folder.
Translating and checking if its working
To verify if everything is working can be done very easily.
Run the game and press ALT + 0 (zero)
If you see this popup show inside the game windows then everything is working.
You can select which online translator it’ll be using.
Press ALT+0 again to hide the window.
You can now just play the game and the translated text will be automatically replaced inside the textbox.
If you are not getting the text translated then go to the next section bellow to configure the tool.
Configure text to translate
Open the BeepInEx/Config/AutoTranslatorConfig.ini file.
There should be a section in there with something similar to:
You can tweak it until you can get only the text you want translated.
It depends of the game but I’ve seen a few that needs EnableIMGUI=True while the default configuration is EnableIMGUI=False. So changing that will probably solve most of the text not being translated problems.
XUnity.AutoTrans caches already made translations on BeepInEx/Translation folder. So if you already translated something it’ll show the translated content without spamming the online translator again. If for any reason you want to tweak the translation manually or make the plugin translate again you can change the files there or simply delete the folder.
You should be done here if you only want the translated games
Advanced – Extracting the untranslated text
While XUnity.AutoTrans is a great tool that can get unity text working fine. It only translates the files and is not a texthooker so its a little bit more complicated to get the untranslated text.
The plugin has a configuration named CopyToClipboard=True, and even an internal TranslatorAggregator but…. Simply put, its either abandoned or it doesn’t work most of the time.
The plugin however enables you to use a custom translator link. And I’ll be using that to make a local HTTP server. The server will then get the “raw japanese text” from the game through a websocket but instead of translating the text it’ll copy it to the clipboard and reply with the translation being the same “raw japanese text”. That way you’ll get the japanese text into your clipboard to use however you want.
I personally use this with chiitranslite to display the kanji readings but I’ve seen people that like to use translatorAggregator to display translation from several different online sites together.
Configuring and running the server
The server runs in python3 so you need that installed to work.
I’ve made an already configured zip together with the server. You can unpack all files in the game root and run the server with the runClipboardHTTP.sh as long as you have python3 installed.
If you’d like do configure yourself here are the steps
Here is a gist for the server: https://gist.github.com/GustJc/ba46236e1ae4e6f42a5668d04f9e0fb0
You then need to configure the custom server hook in the XUnity.Translator config file to be:
You then change the translator to Custom translator from inside the game in the ALT+0 popup
After that you run the server and when you play the game the server will receive the raw text and copy it to your clipboard.
Just came to say thanks for this post. It’s frustrating they didn’t enable copying raw text to clipboard without passing through a translation service. The Python script does the job perfectly.
So looks like they save the raw text and translated text as key-value pairs locally? Lol