Skip to main content

Module text

Module text 

Source
Expand description

Filling in a text’s placeholders: {name} by a value the caller gives (fill_values), or by what the caller looks up for it, such as the key the player has for an action (fill, Ctx::text_with).

Enums§

Label
Text a view holds before it is shown: a text key with the values of its placeholders, put in the player’s language by the skin when it paints (Ctx::label), or text as it is. Logic that doesn’t know the player’s language builds views of keys, and they need no rebuilding when the language changes.

Constants§

CURSOR
The placeholder for the keys that move the cursor ({Cursor}).

Functions§

check_key_placeholders
Checks that every placeholder of screen text text, read from path in bundle, can be filled: a capitalized {Name} names a key, so it must be {Cursor} or an action of A, as key_text fills them. A lowercase {name} is a value a screen passes (Ctx::text_with’s args), which no file can know, and passes. Each error names the file, the key’s line and the known actions, with code SH2008 (unknown-name).
fill
text with each {name} replaced by its value in args, else by what lookup gives for it, else left as written. What is filled in is not looked at again, so a value may hold braces. An unclosed { and what follows it are plain text.
fill_values
text with each {name} that args names replaced by its value, and nothing else: for text built where there are no keys to name (a line of a list, a label). Anything else in braces is left alone.
key_text
What a {name} placeholder that names a key says: {Cursor} the cursor keys, {Confirm} (an action’s name) the key keys has for that action. None for any other name. What a game’s text fills in by default (GameData::key_text).