Preparation for Translation in Ren'py (Patreon)
Content
Good health, dear Cossacks!!! Welcome to the first part of the guide to translating games on the Ren'py engine. Here we will do everything necessary before we start translating the game itself. So, let's get started!
DOWNLOADING THE ENGINE. Install version 8.4.1 of Ren'py Launcher from the official website. This version is relevant for the current release. Translation is impossible without the engine's functionality, so this is a mandatory step.
INSTALLING THE EDITOR. Install VS Code, a convenient editor with Ren'py syntax support. After installation, add the Ren'py extension via the corresponding tab (screenshot 1). This editor is recommended for ease of use, and we actively use it ourselves.
FILE STRUCTURE. Let's take a look at the general structure for translation. First, go to the game's ‘game’ directory. This is where all the main game files are located, excluding those used by the engine. You will see "code" – this is the main code folder containing all dialogues, mechanics, interface, etc. Get to know the general structure, as it will come in handy later. Of course, in addition to the code files, the game has audio, sprites, animations, and interface — all of which are stored in the archive.rpa file. The "game" directory is in release form, meaning that everything is hidden and packed. This is what we need to change in order to work on the translation.
THE PRINCIPLE OF UNPACKING. In the Ren'py engine, the main code format for files is .rpy. In 99.9% of cases, these files contain dialogues, scenes, mechanics, UI — basically everything that is in the game in terms of code. To improve performance, the engine converts these files to another format - .rpyc, but in fact, this is just compiled code from .rpy files. You may have seen them in the code folder instead of the .rpy files we need, as this format is packed in the release version. That is, for example, if you have a script.rpyc file, you will definitely have script.rpy as well. The task is that in order to create a translation for the game, we must convert the compiled .rpyc files back to .rpy. If you need asset files from archive.rpa, they can also be extracted. This is discussed in the next section.
UNPACKING GAME FILES. We have tested and confirmed two effective unpacking programmes: UnRen and RPA Extract. Both are good options, but we suggest starting with the first one. So, first add the Unren or RPA Extract file to the "game" directory of your game (where the archive.rpa file is located). Then follow the instructions for each programme:
Unren – run the file, and a console menu should appear (screenshot 2). You need to select option 1 to unpack the game assets and option 2 to unpack .rpyc into .rpy. If everything went well, you should see .rpy source files with the same names as the .rpyc files in the "code" folder. Please note that Python must be installed on your computer for the programme to work. The version tested on is 3.9.0.
RPA Extract – select the "archive.rpa" file and drag it onto the rpaExtract.exe file, as shown in screenshot 3. After that, all assets and .rpy files should appear in the directory.
CREATING A TRANSLATION. Now the easiest part remains – creating the translation files in the game. Run Ren'py Launcher, go to settings and select the folder where your game is located. Make sure that your game is displayed in "Projects" (screenshot 4). Select your project and click "Generate translations" (screenshot 5). On the next page, enter the name of your language, then click "Generate translations" (screenshot 6).
TRANSLATION FILE STRUCTURE. If everything went well, you should see a folder in the "tl" directory with the name of your language. You will see that inside there is a similar folder called ‘code’ with .rpy files, which you saw in the "game" directory. These are our translation files for the game, which you will be working with all the time. There is no need to change anything in the original code files. At this stage, the preparation is complete.
!!!CONGRATULATIONS!!! It seems you have completed the first part of the guide and everything worked out for you! This is the first version of "Preparation for Translation in Ren'py", so it will be improved in the future. If we have missed something, you can write about it in the comments or ask a question. Thanks for your attention!!! Budmo!!! Stand with Ukraine!!!