What it does
Returns the text of a translation key in the game's current language.
Syntax
1
Translate(textKey string) → string2
Translate(textKey string, varsJson string) → stringParameters
| Name | Type | In forms | Meaning |
|---|---|---|---|
| textKey | string | all | The key in the scene's localization table, such as menu.start. |
| varsJson | string | 2 | Optional JSON object whose values fill the {{name}} placeholders of the text. |
Every form returns
string
The translated text. A key missing in the current language uses the fallback language; a key missing everywhere returns the key itself.
Good to know
- Seeing the raw key on screen is the visible sign that a translation is missing.
Example · generated
Form 1, the short one
DO Print(Translate("score")) Sync()LOOPForm 2, with every argument
DO Print(Translate("score", "{}")) Sync()LOOPTranslate is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.