libgui 2.01
libgui is a GUI library for the GameCube, Wii, and Wii U
 
Loading...
Searching...
No Matches
GuiTextTranslator Class Reference

Hashed msgid -> UTF-8 string table loaded from a single binary .lang blob (see loadLanguage()). More...

#include <GuiTextTranslator.h>

Public Member Functions

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.
 

Detailed Description

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.

Examples
demo.cpp.

Definition at line 15 of file GuiTextTranslator.h.

Constructor & Destructor Documentation

◆ GuiTextTranslator()

GuiTextTranslator::GuiTextTranslator ( )

Definition at line 14 of file GuiTextTranslator.cpp.

◆ ~GuiTextTranslator()

GuiTextTranslator::~GuiTextTranslator ( )

Definition at line 18 of file GuiTextTranslator.cpp.

Member Function Documentation

◆ clear()

void GuiTextTranslator::clear ( )

Clears the current translation dictionary and frees memory.

Definition at line 161 of file GuiTextTranslator.cpp.

◆ getText()

const char * GuiTextTranslator::getText ( const char * msgid) const

Retrieves the translated UTF-8 string for a given ASCII message ID.

Parameters
msgidThe English text/ID to translate
Returns
The translated string, or the original msgid if not found

Definition at line 248 of file GuiTextTranslator.cpp.

◆ loadLanguage()

bool GuiTextTranslator::loadLanguage ( const uint8_t * buffer,
size_t size )

Loads and parses a translation file from a memory buffer.

Parameters
bufferPointer to the loaded file data
sizeLength of the buffer in bytes
Returns
true if successful, false otherwise

Definition at line 190 of file GuiTextTranslator.cpp.


The documentation for this class was generated from the following files: