GGUI/Public/UIStrings.h file

Localisation: text passed to a widget is a lookup key.

It is either the source-language text itself or a string ID ("UI.KeyBinding.Prompt"). IDs survive rewording; plain text is quicker to write.

ui.Label("Slow Brain");                                       // looked up; shown as written if untranslated
ui.Label(GGText("{count} entities", { { "count", n } }));     // named placeholders, so translations can reorder
ui.Label(GGText("{gold} gold", { { "gold", GGBind(player, gold) } }));   // a placeholder bound to data
ui.Label(GGText::Verbatim(playerName));                       // data: never looked up

A GGStringTable holds one language, keyed by the hash of the key. Give a document the active table with UIContext::SetStrings. Swapping or editing the table re-resolves and re-lays out all interface text; no component function re-runs.

Lookup order: the active table, then GGStringTable::Defaults(), then the key as written. The library's own strings are all IDs with English text in Defaults.

Looked up: labels, button/toggle/menu labels, text tooltips, dropdown and choice options, placeholders. Never looked up: user-typed text, numbers, data-source cells, GGText::Verbatim.

Namespaces

namespace GGUI

Classes

class GGUI::GGStringTable
One language. Not thread-safe: fill it before use, and change a table that is in use only on the thread that updates its documents.
struct GGUI::GGTextArg
A value for a named placeholder: an integer, a real, text, or a bound number.
class GGUI::GGText
Text passed to a widget: a key to look up (what strings convert to), a format with values, or verbatim data. Only valid for the duration of the call.
class GGUI::GGKeptText
A GGText kept past the call it was given in (a dialog's question, built later): its format and arguments copied. Text() is valid while it lives.