localization - Poobslag/turbofat GitHub Wiki

The localization process has two steps: extracting message files from the game and translating the message files. Extracting message files from the game requires technical expertise, but you do not need to know a second language. Translating the message files requires linguistic expertise, but you do not need to know programming.

Extracting message files from the game

Configuring your system for localization

  1. (Windows) Install gettext from https://mlocati.github.io/articles/gettext-iconv-windows.html

  2. (Windows) Install python from https://www.python.org/downloads/

  3. Install babel and babel-godot:

    pip install babel babel-godot

Updating the PO template

  1. Launch ReleaseToolkit.tscn in Godot and click the Extract Localizables button. This will update the localizables-extracted.py file with data from the game's levels and conversations.
  2. Run the pybabel-extract.sh script. This will update the messages.pot template file.

Creating and updating message files

To create a new messages file from the PO template:

msginit --no-translator --input=project/assets/main/locale/messages.pot --locale=fr

To update an existing messages file from the PO template:

msgmerge --update --backup=none -N project/assets/main/locale/es.po project/assets/main/locale/messages.pot

Translating the message files

The message files are available in various .po files in the gettext format. gettext is a standard format, which can be edited using any text editor or GUI editors such as Poedit.

msgid "Hello world!"
msgstr ""

Messages in gettext are made of msgid and msgstr pairs. msgid is the source string in English, msgstr will be the translated string.

You can add or change a translation by changing the value of msgstr. Do not change the value of msgid, these values are automatically extracted from the game's code. If the msgid needs to change, the game will need to be updated, and a new message file generated.

msgid "Hello world!"
msgstr "¡Hola Mundo!"