Internationalizing games
Localization is usually done by specific studios hired for the job and, despite the huge amount of software and file formats available for this, the most common way to do localization to this day is still with spreadsheets. The process of creating the spreadsheets and importing them is already covered in the tutorial, so this one could be seen more like a follow-up to that one.
Note
We will be using the official demo as an example; you can download it from the Asset Library.
Configuring the imported translation
Translations can get updated and re-imported when they change, but they still have to be added to the project. This is done in Project → Project Settings → Localization:
The above dialog is used to add or remove translations project-wide.
It is also possible to instruct Godot to use alternate versions of assets (resources) depending on the current language. The Remaps tab can be used for this:
Select the resource to be remapped, then add some alternatives for each locale.
Converting keys to text
Some controls, such as Button and , will automatically fetch a translation if their text matches a translation key. For example, if a label’s text is “MAIN_SCREEN_GREETING1” and that key exists in the current translation, then the text will automatically be translated.
This automatic translation behavior may be undesirable in certain cases. For instance, when using a Label to display a player’s name, you most likely don’t want the player’s name to be translated if it matches a translation key. To disable automatic translation on a specific node, use Object.set_message_translation and send a to update the translation:
For more complex UI nodes such as OptionButtons, you may have to use this instead:
In code, the Object.tr() function can be used. This will just look up the text in the translations and convert it if found:
The same text in different languages can vary greatly in length. For this, make sure to read the tutorial on Size and anchors, as dynamically adjusting control sizes may help. can be useful, as well as the text wrapping options available in Label.
TranslationServer
Godot has a server handling low-level translation management called the TranslationServer. Translations can be added or removed during run-time; the current language can also be changed at run-time.
First, in the Project Settings, under Input Devices > Locale, there is a Test property. Set this property to the locale code of the language you want to test. Godot will run the project with that locale when the project is run (either from the editor or when exported).
Keep in mind that since this is a project setting, it will show up in version control when it is set to a non-empty value. Therefore, it should be set back to an empty value before committing changes to version control.
Translations can also be tested when running Godot from the command line. For example, to test a game in French, the following argument can be supplied:
Translating the project name
The project name becomes the app name when exporting to different operating systems and platforms. To specify the project name in more than one language, create a new setting in the Project Settings and append the locale identifier to it. For instance, for Spanish, this would be application/name_es
:
If you are unsure about the language code to use, refer to the .