Code Monkey home page Code Monkey logo

gdgettext's Introduction

gdtexttext

Important

Since Godot 4.0, the editor can generate a PO template automatically from specified scene and GDscript files. See Automatic generation using the editor for more information. You don't need gdgettext anymore.

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

Open Poedit Preferences and add a new extractor in the Extractors tab and enter the following settings:

Setting Value
Language Godot
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

Then create a new .po file and press Extract from sources and set the root of your Godot project as the Base path and add paths containing the translatable strings to the Paths section.

After this Poedit will use gdgettext to extract all translatable strings and you can start editing the .po file using Poedit.

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.

gdgettext's People

Contributors

mrombout avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gdgettext's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.