The official GNU gettext manual can be found here
Most of the strings for a language are inside its respective po file. You can read more about this format here.
Outside of this folder, there is the assets/GodSVG.desktop file which has a few fields that can be internationalized.
New translatable strings must be within GDScript files, inside a Translator.translate()
method. If they are part of a persistent UI, they must also respond to the Configs.language_changed
signal.
To include or update strings, open godot_only/scripts/update_translations.gd in the Godot editor and follow the comment on top.
Important
To run the above script, you must install gettext tools. It's preinstalled on most Linux distributions and Git Bash on Windows.
With editor (Poedit):
- Open
GodSVG.pot
in Poedit - Click "Create new translation", choose the language and start adding your translation.
- Save the file and delete the
.mo
. - Update project settings to include the new translation.
- Create a pull request with your changes.
- Duplicate
GodSVG.pot
file and rename it to the locale code of the new language<locale code>.po
. - Open it in a text editor, add the locale code in the info at the top (
"Language: <locale code>
) and insert translated strings in themsgstr "<your translation>"
spots. - Update project settings to include the new translation.
- Create a pull request with your changes.
- Find the file with the locale code of the language you want to edit. Open it in your editor.
- Search for the translation you want to change and change it.
- Create a pull request with your changes.
Translation changes can be viewed by running the project from the Godot editor. If you added a new language, you need to make sure it's added in the project settings.