Getting your game translated into as many languages as possible will surely help with gaining a wider audience. Luckily, Ren’Py makes translating games fairly easy.
Load up the Ren’Py launcher and select “Generate Translations”. You’ll be presented with a screen where you can enter the name of the language and select a few options. Make sure only “Generate empty strings for translations” is selected and hit the “Generate Translations” button above the option.
Ren’Py will now scan your game and generate the necessary translation files, it’s able to compile your entire script (the process will fail if your game contains any programming errors). The generated translation files will be available at the following path
Your Game Name/game/tl/*language_name*. The files are just regular .rpy files with the following structure:
# game/script.rpy:19 translate klingon start_915cb944: # "It's only when I hear the sounds of shuffling feet and supplies being put away that I realize that the lecture's over." ""
Ren’Py also uses another syntax, mostly for interface elements, such as button labels or menu items:
translate klingon strings: # screens.rpy:251 old "Back" new ""
You can now start translating your game by providing the translated string inside the double quotes or package everything up and send the files to your translator.
Every time you change something in your script you’ll need to repeat the process of generating new translation files. So click “Generate Translations”, enter the name of the translation you want to update, and hit “Generate Translations” again.
Ren’Py is smart enough to keep existing translations already present in the
/game/tl folder and append the new untranslated strings to the bottom of each file.
After the translation is ready, the only thing left is to wire up the ability to switch languages in the game’s preferences. The first button activates the None language, which is English by default, while the second switches to the language with the name you provided earlier.
textbutton _("English") action Language(None) textbutton _("Klingon") action Language("klingon")
Please beware that unfinished translation might make parts of your application unavailable, as Ren’Py doesn’t revert back to the default language when a translation is unavailable. If you need to switch back to the default language open up the developer console (
Shift+O) and type:
renpy.change_language(None) Your game should be in English again, or in the language, you set as default.
Some developers might expect Ren’Py to support a common standard like gettext Portable Object files (PO). This isn’t supported out of the box by the framework, but Beuc (the developer who brought us Ren’Py Web) provides a translation toolkit that makes this possible.