Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBLanguage is a basic language string manager. More...
#include <tb_language.h>
Public Member Functions | |
bool | Load (const TBStr &filename) |
Load a file into this language manager. More... | |
void | Clear () |
Clear the list of strings. More... | |
TBStr | GetString (const TBID &id) |
Return the string with the given id. More... | |
TBLanguage is a basic language string manager.
Strings read into it can be looked up from a TBID, so either by a number or the hash number from a string (done by TBID).
Ex: GetString(10) (Get the string with id 10) Ex: GetString("new") (Get the string with id new)
In UI resources, you can refer to strings from language lookup by preceding a string with
Ex: TBButton: text: (Create a button with text from lookup of "close")
void tb::TBLanguage::Clear | ( | ) |
Clear the list of strings.
Return the string with the given id.
If there is no string with that id, "<TRANSLATE!>" will be returned in release builds, and "<TRANSLATE:%s>" (populated with the id) will be returned in debug builds.
bool tb::TBLanguage::Load | ( | const TBStr & | filename | ) |
Load a file into this language manager.
Note: This adds strings read from the file, without clearing any existing strings first.