Skip to content

Latest commit

 

History

History
43 lines (28 loc) · 1.49 KB

README.rst

File metadata and controls

43 lines (28 loc) · 1.49 KB

Babel Godot plugin

This is a plugin for Babel, the internationalization library, that adds support for scene as well as resource files from the Godot game engine.

About this fork

As this program consists of only one file which I adjusted a lot to fit the needs of my project, this fork deviates from upstream / is unlikely to be synced. Additional features in this fork are:

  • Compatible with Godot 4
  • Built-in scripts (GDScript saved in scene files as sub-resource) are parsed for tr(...).
  • Arrays of strings are being included.
  • No issues with multiline strings.

Installation

Install Babel and this plugin:

pip install Babel git+https://github.com/h0lley/pybabel-godot.git#egg=babel-godot

Usage

Using a mapping file like this:

[python: **.gd]
encoding = utf-8
extract_messages = tr

[godot_scene: **.tscn]
encoding = utf-8

[godot_resource: **.tres]
encoding = utf-8

you can extract messages to be translated from both your .gd and .tscn files using:

pybabel extract -F babel_mapping_file -k Label/text -k Resource/catchphrase -k tr -o translations.pot .

You can then create .po files from the POT catalog using Poedit, or online services such as Crowdin, Transifex, or Weblate.

See testproject/ in the repository for an example.