Locale

The locale system provides centralized text management for your game. Use it to store UI strings, messages, labels, and any text that may need translation.

Locale entries are defined in the engine editor under General > Locale.


Locale Entries

Each entry has:

FieldDescription
idKey used to look up this text in code
valThe text value. Supports `
tagsOptional tags for filtering and organization

API

game.getLine(lineId, params?)

Returns the localized string for the given ID, with placeholder substitution.

ParameterTypeDescription
lineIdstringLocale entry ID
paramsRecord<string, any>Values to substitute for `

Returns [lineId] if no entry is found (easy to spot missing translations).

// Simple lookup
const label = game.getLine("battle_start");
// "The battle begins!"

// With placeholders
const msg = game.getLine("damage_dealt", { name: "Goblin", amount: 50 });
// Locale val: "|name| took |amount| damage!"
// Result: "Goblin took 50 damage!"

Placeholders

Use |placeholder| syntax in locale values for dynamic content. All occurrences of a placeholder are replaced.

Locale entry:

id: "item_acquired"
val: "You found |count|x |item|!"

Code:

game.getLine("item_acquired", { count: 3, item: "Iron Sword" });
// "You found 3x Iron Sword!"

Ability Description Integration

The locale system integrates with buildAbilityEffectsDescription and buildAbilityMetaDescription. Inline chooseOne/chooseMany option values (e.g., "fire", "all_targets") are automatically looked up in the locale when generating descriptions.

Example: An ability with damage_type: "fire" and the ingame_description template "Deal [v] [damage_type] damage":

  • Without locale entry for "fire": renders as "Deal 50 fire damage"
  • With locale entry id: "fire", val: "Fire": renders as "Deal 50 Fire damage"

Quick Reference

I want to...Do this
Add locale entriesGeneral > Locale in the editor
Look up a stringgame.getLine("my_key")
Use placeholdersgame.getLine("key", { name: "value" })
Localize ability optionsAdd locale entries matching option IDs
Ship plugin defaultsAdd locale array to plugin data field