Godot

AI translation for Godot with Lingo.dev CLI

What is Godot?

Godot is an open-source game engine for creating 2D and 3D games. It has built-in internationalization support through CSV and PO file formats for managing game translations.

What is Lingo.dev CLI?

Lingo.dev is an AI-powered translation platform. The Lingo.dev CLI reads source files, sends translatable content to large language models, and writes translated files back to your project.

About this guide

This guide explains how to set up Lingo.dev CLI in a Godot game project. You'll learn how to configure translation files, set up a translation pipeline, and integrate the translations into your game.

Step 1. Set up translation files

Create a CSV file for your game's translatable strings (e.g., strings.csv):

keys,en
WELCOME,"Hello, world"

Godot will auto-generate .translation files from this CSV (e.g., strings.en.translation, strings.es.translation).

Note: In Godot, it's convention for keys to be uppercase, but this isn't strictly required.

Step 2. Configure the CLI

In the root of your Godot project, create an i18n.json file:

{
  "$schema": "https://lingo.dev/schema/i18n.json",
  "version": 1.8,
  "locale": {
    "source": "en",
    "targets": ["es"]
  },
  "buckets": {
    "csv": {
      "include": ["strings.csv"]
    }
  }
}

This file defines:

  • the CSV files that Lingo.dev CLI should translate
  • the languages to translate between

In this case, the configuration translates CSV files from English to Spanish.

Step 3. Translate the content

  1. Sign up for a Lingo.dev account.

  2. Log in to Lingo.dev via the CLI:

    npx lingo.dev@latest login
    
  3. Run the translation pipeline:

    npx lingo.dev@latest run
    

    The CLI will update your CSV file with the translated content and create an i18n.lock file for keeping track of what has been translated (to prevent unnecessary retranslations).

Step 4. Configure languages in Godot

  1. Navigate to Project > Project Settings.
  2. Switch to the Localization tab.
  3. Click Add.
  4. Select the auto-generated .translation files.
  5. Click Open.

Step 5. Use the translations

UI controls

  1. Select a node (e.g., a Button or a Label).
  2. Open the Inspector pane for the node.
  3. Set the Text attribute to a key from a translation file (e.g., "WELCOME").
  4. Ensure that the Auto Translate option is enabled. (It is by default.)

GDScript

Use the tr function to access translations:

tr("WELCOME")

C#

Use the Tr function to access translations:

Tr("WELCOME")

Step 6. Test the translations

  1. Navigate to Project > Project Settings.
  2. Enable Advanced Settings.
  3. Navigate to Internationalization > Locale.
  4. In the Test field, enter a locale (e.g., "es").
  5. Run the game.

Known limitations

  • The locale codes that Godot supports aren't guaranteed to match the locale codes that Lingo.dev supports. To learn what locale codes are available, see the official documentation.

Next steps

To learn more about Godot's translation system, see: