acron.strings¶
A string table with locales: every word an interface shows, by a stable key, with a translation merged over it.
The mechanism a localised game needs and RmlUi does not give: a reference
table ({key: text}, the writing’s own language), a locale file of the
same keys in another language merged over it (a key the locale lacks falls
back to the reference), the check that tells a translator what is missing
and what went stale, and the export a translation starts from. The keys,
the texts and where the documents get filled are the game’s.
StringTableholds the reference and the active table:tr()formats a key’s text with its fields;rml()escapes it for RmlUi unless the key is in the markup set (a bold, a line break authored on purpose);fill()writes keys into a document’s static elements (an element the document lacks is skipped — a proof of concept’s document still loads);load_locale()merges a file over the reference, or resets to it.read_locale()reads one locale file defensively — only its string entries, so a malformed file cannot put a number on screen — andavailable()lists the languages a directory holds.check()compares a locale against a reference: the keys it is missing, and the keys it carries that the reference no longer has (stale — the text moved, so a derived id changed).
|
A reference table and the locale merged over it. |
Global Functions