It is possible to translate Ren'Py itself. A complete translation translates the GUI, various Ren'Py messages, new projects, and the launcher. This should cover most gameplay and development scenarios. Right now, not every error message can be translated.
To create a new translation:
The same procedure can be used to update a language translation. To access the created translation, return to the preferences, then choose the newly created language. Note that by default, the translation will be a copy of the English translation.
The translation files live in launcher/game/tl/language/. With the exception of script.rpy, all files consist of string translations that can be translated using the string translation syntax. Some strings might begin with "## ". These are comments that are translated, wrapped, and included in the options.rpy and gui.rpy files.
The translation files are:
Ren'Py ships with a default font (DejaVuSans) that covers most western languages, but other fonts are often needed. A font can be configured by editing launcher/game/tl/language/style.rpy, and adding the code:
init python: translate_font("language", "myfont.ttf")
Where "language" is the language in question (for example, "japanese"), and "myfont.ttf" is the font that should be used (for example, "MTLc3m.ttf"). The font file should be placed in the launcher/game/tl/language directory, so it can be found by the launcher.
The styles used by the launcher can be configured by setting variables in a translate python block. The following variables are available. The names are a bit confusing, as they reflect the English-language translation.
These variables are only available in the launcher.
gui.LIGHT_FONT= "Roboto-Light.ttf" link
The path to the font used for normal text in the launcher.
gui.REGULAR_FONT= "Roboto-Regular.ttf" link
The path to the font used for heavy-weight text in the launcher.
gui.REGULAR_BOLD= False link
If true, heavy-weight text is bolded.
gui.FONT_SCALE= 1.0 link
A scaling factor that is applied to all text in the launcher.
A translate python block is used to set these variables. For example, the following code is used to change the fonts in the Arabic translation of Ren'Py:
translate arabic python: gui.REGULAR_FONT = "DejaVuSans.ttf" gui.LIGHT_FONT = "DejaVuSans.ttf" gui.FONT_SCALE = .9 gui.REGULAR_BOLD = True
The following functions are used to configure translation in the launcher. They should be called from the init python block.
translate_font(language, font) link
This is used to set a font for language. The font is used in the launcher, and also used to in games generated in that language. The font file should be placed in game/fonts.
translate_define(language, define, value, help=None) link
This is used to set a define when generating a game. For example, it can be used to change the size of a font.
For example, the following code changes the size of dialogue text:
translate_define("martian", "gui.text_size", 12)