Logic & UI

Localization

Translate UI text into several languages with @keys and per-language tables, and switch language in the editor.

The Localization panel: the active language, a German column to compare, and the CSV tools

How it works

  • UI Text whose string starts with @ is a key, not text: @menu.newgame shows "New Game" in English and "Neues Spiel" in German.
  • Each language is one table in Assets/Localization/, named by its code: en.tgloc, de.tgloc, and so on. English (en) is the master list of keys; add a key there first.
  • A key missing from the active language falls back to the English text. A key missing everywhere shows as ⟪key⟫, so it's easy to spot.
  • Translations travel as CSV (key,en,de,…, one row per key); the tables themselves are a compact binary format you don't edit by hand. Project > Import refuses .csv and .tgloc files; use the Localization panel.

The Localization panel

Open Windows > Localization.

PartWhat it does
Active languagethe language the editor shows now, its key count, and a button per available language. Click one to switch: every @key text on screen changes at once.
Compare withadds another language as an extra column in the grid, side by side. Clear columns removes them.
path, Export CSVsaves the grid (the key, the active language and any compared columns) as CSV: the web editor downloads it, the desktop editor writes it to the path
language code, All columns, Import CSV…imports the column with that code, or every language column with All columns ticked: the web editor opens a file chooser, the desktop editor reads the path. Each imported column replaces that language's table
Rescanlooks for new language tables
the gridevery key with its text; (missing) marks a key without a translation

After clicking de: the active language is Deutsch and the texts were re-shaped

How to translate a game

  1. Write your UI texts as keys: in a Text element's Text Style box type @title.start instead of Start. Use dotted names by screen or topic (menu.…, hud.…, dlg.…).
  2. Keep en active, Compare with every other language, and Export CSV to get the whole table.
  3. Add your keys as rows, and a column per new language (for example cs for Czech), in any spreadsheet. Keep the first column key and the column names equal to the language codes. Save as CSV, UTF-8.
  4. Tick All columns and click Import CSV…. A new language appears under Active language; click it to check.

Switching language in the game

The panel switches the language in the editor. For players, a dropdown wired to the built-in game-menu system switches it; Meadow Quest's menu shows how. A script's SetText can show keys (@quest.talk), see Part 16.

Good practices

  • Never type player-facing text directly in a game you might translate: use a key from the start. Retrofitting keys later means touching every screen.
  • Keep en complete. It's the fallback for every other language, so a missing English string shows as ⟪key⟫ everywhere.
  • Leave room. German and Czech strings are often a third longer than English; size buttons and boxes for the longest language, or use Overflow: Wrap in Text Style.
  • Text painted into images can't be translated. Speech bubbles drawn as sprites (as in Meadow Quest) stay in the language they were painted in.
  • Check with Compare. Add the other languages as columns and look for (missing) before you publish.