Read the strings of a language and of en-us, each a JSON object of strings by key, from strings/LANGUAGE.json and strings/en-us.json under assets, for the race and the menus.
More...
#include <stringresources.h>
Read the strings of a language and of en-us, each a JSON object of strings by key, from strings/LANGUAGE.json and strings/en-us.json under assets, for the race and the menus.
A key the language lacks takes its en-us string.
◆ GameText() [1/2]
Load strings and register the exclusive active catalogue with SDL.
- Parameters
-
| assets | The prepared asset directory with strings/LANGUAGE.json and strings/en-us.json. |
| language | The requested language; missing keys use en-us strings. |
◆ ~GameText()
| coastline::GameText::~GameText |
( |
| ) |
|
Unregister the active catalogue and invalidate references to its strings.
◆ GameText() [2/2]
| coastline::GameText::GameText |
( |
const GameText & | | ) |
|
|
delete |
Prevent copying the registered catalogue.
◆ operator=()
Prevent assignment of the registered catalogue.
◆ Active()
| GameText * coastline::GameText::Active |
( |
| ) |
|
|
static |
- Returns
- The active text catalogue, or null outside its lifetime.
◆ Language()
| const std::string & coastline::GameText::Language |
( |
| ) |
const |
|
inline |
- Returns
- The selected language.
◆ Empty()
| bool coastline::GameText::Empty |
( |
| ) |
const |
|
inline |
- Returns
- Whether the catalogue is empty.
◆ Find()
- Parameters
-
| key | The catalogue key to query without logging a missing translation. |
- Returns
- The stored string, valid for the catalogue's lifetime, or null when unavailable.
◆ Resolve()
- Parameters
-
| key | The catalogue key, whose storage must outlast a returned fallback view. |
- Returns
- The stored string or
key, logging a missing key once per catalogue.
The documentation for this class was generated from the following file: