documentation indexreference manualfunction index

Localizing Ren'Py

While Ren'Py is by default set up to operate in an English speaking environment, it is not limited to such settings. Assuming a proper font is loaded, Ren'Py scripts can contain any language expressible in Unicode.

There are two things in the Ren'Py library that may need to be translated into a user's language. The first is the main menu. There is no explicit support for doing this, but as the config.main_menu variable supports changing the text of the main menu, it also supports translating said text.

The second thing that needs to be translated is the game menu. The config.translations dictionary is used to translate text in the game menu into your language. If a key in this map corresponds to the English text that would be displayed, the value corresponding to that key is displayed again. For example:

init:
    $ config.translations = {
        "Yes" : u"HIja'",
        "No" : u"ghobe'",
        # etc.
        }

The u characters prefixed to the strings on the right, while not strictly necessary in this case, are used to tell Python that the string is in Unicode rather than ASCII. This is useful if your language uses non-ascii characters.


The _ Function

Translation actually occurs using a function, named _, to look up the translation of a string. The default function uses config.translations as described above, but _ can be re-defined to use an alternate means of determining the translation.

Function: _ (s):

This function is called to translate s into the local language.


documentation indexreference manualfunction index