Hashed msgid -> UTF-8 string table loaded from a single binary .lang blob (see loadLanguage()). More...
#include <GuiTextTranslator.h>
Public Member Functions | |
| constexpr | GuiTextTranslator () |
| constexpr on purpose: an instance defined at namespace scope is then constant-initialized (it is laid out in the binary and no constructor runs at startup), so it is already valid for any static initializer in any translation unit, whatever the link order. | |
| bool | loadLanguage (const uint8_t *buffer, size_t size) |
| Loads and parses a translation file from a memory buffer. | |
| const char * | getText (const char *msgid) const |
| Retrieves the translated UTF-8 string for a given ASCII message ID. | |
| void | clear () |
| Clears the current translation dictionary and frees memory. | |
Hashed msgid -> UTF-8 string table loaded from a single binary .lang blob (see loadLanguage()).
GuiText and other classes call getText() to resolve a message ID to translated text.
Definition at line 15 of file GuiTextTranslator.h.
|
inlineconstexpr |
constexpr on purpose: an instance defined at namespace scope is then constant-initialized (it is laid out in the binary and no constructor runs at startup), so it is already valid for any static initializer in any translation unit, whatever the link order.
Definition at line 21 of file GuiTextTranslator.h.
| GuiTextTranslator::~GuiTextTranslator | ( | ) |
Definition at line 14 of file GuiTextTranslator.cpp.
| void GuiTextTranslator::clear | ( | ) |
Clears the current translation dictionary and frees memory.
Definition at line 189 of file GuiTextTranslator.cpp.
| const char * GuiTextTranslator::getText | ( | const char * | msgid | ) | const |
Retrieves the translated UTF-8 string for a given ASCII message ID.
| msgid | The English text/ID to translate |
Definition at line 279 of file GuiTextTranslator.cpp.
| bool GuiTextTranslator::loadLanguage | ( | const uint8_t * | buffer, |
| size_t | size ) |
Loads and parses a translation file from a memory buffer.
| buffer | Pointer to the loaded file data |
| size | Length of the buffer in bytes |
Definition at line 221 of file GuiTextTranslator.cpp.