Skip to content
The `gdgettext` program extracts translatable strings from given Godot input files.
Go GDScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
example
test
.goreleaser.yml
.travis.yml
LICENSE
README.md
extract.go
extract_test.go
filesystem.go
go.mod
main.go
main_test.go
process.go
process_test.go
render.go
render_test.go

README.md

gdtexttext

Actions Status Go Report Card

The gdgettext program extracts translatable strings from given Godot input files. It is meant as an alternative for xgettext specifically for games using Godot Engine.

Currently it extracts translatable strings using the following rules:

  • .tscn - every text parameter being set
  • .gd - every call to tr()

Installation

$ go get github.com/mrombout/gdgettext

Usage

$ gdgettext [option] [inputfile]...

Options

-o file
--output=file
    Write output to specified file (instead of `messages.po`).

Poedit

Go to File - Preferences and add a new extractor in the Extractors tab and enter the following settings:

Setting Value
List of extensions separated by semicolons (e.g. .cpp;.h) ‪*.gd;*.tscn
Command to extract translations ‪gdgettext -o %o %F
An item in input files list %f
travis g

Godot

Use tr() in your .gd files or set the text attributes on the Controls in your scene (e.g. Button) to make strings translatable.

Using poedit gdgettext parses all your .tscn and .gd files and creates a .po file containing all translatable strings.

Now use poedit to translate all translatable string to your desired messages.

You can also create new translation files from the .po files for each language you want to support. For each language you generally create a .po file using the language code as the file name (e.g. nl.po, en.po, no.po, ja.po).

Load all .po files in your Godot project settings.

You can’t perform that action at this time.