GlistEngine
Loading...
Searching...
No Matches
gLocalization Class Reference

#include <gLocalization.h>

Public Member Functions

 gLocalization ()
 
virtual ~gLocalization ()
 
void loadDatabase (const std::string &database, const std::string &tableName="WORDS")
 
std::string localizeWord (const std::string &word)
 
void setCurrentLanguage (int languageId)
 
std::string getCurrentLanguage () const
 
const std::vector< std::string > & getAvailableLanguages () const
 
int getLangId () const
 
std::string getTableInfo ()
 
std::string getColumnData (const std::string &columnname)
 
const std::vector< std::string > & getColumnList () const
 

Detailed Description

Database-driven localization system for multi-language text translation. Expects database table with "Key" column and language columns.

Constructor & Destructor Documentation

◆ gLocalization()

gLocalization::gLocalization ( )

◆ ~gLocalization()

virtual gLocalization::~gLocalization ( )
virtual

Member Function Documentation

◆ getAvailableLanguages()

const std::vector< std::string > & gLocalization::getAvailableLanguages ( ) const
Returns
Available language columns (excluding "Key")

◆ getColumnData()

std::string gLocalization::getColumnData ( const std::string &  columnname)

◆ getColumnList()

const std::vector< std::string > & gLocalization::getColumnList ( ) const

◆ getCurrentLanguage()

std::string gLocalization::getCurrentLanguage ( ) const
Returns
Current language column name, empty if invalid

◆ getLangId()

int gLocalization::getLangId ( ) const

◆ getTableInfo()

std::string gLocalization::getTableInfo ( )

◆ loadDatabase()

void gLocalization::loadDatabase ( const std::string &  database,
const std::string &  tableName = "WORDS" 
)

Load localization database and parse available language columns

Parameters
databaseDatabase file path
tableNameTable containing translations (default: "WORDS")

◆ localizeWord()

std::string gLocalization::localizeWord ( const std::string &  word)

Translate word using current language setting

Parameters
wordKey to look up in database
Returns
Translated text, or original word if not found

◆ setCurrentLanguage()

void gLocalization::setCurrentLanguage ( int  languageId)

Set active language by column index (0-based, excluding "Key" column)

Parameters
languageIdLanguage index (bounds-checked)

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