LangTable

Provides the code necessary to handle the low level management of the string tables for localization.

Inherit:
SimObject

Description

One LangTable is created for each mod, as well as one for the C++ code. LangTable is responsible for obtaining the correct strings from each and relaying it to the appropriate controls.

Methods

int LangTable::addLanguage(string filename)

Adds a language to the table.

Parameters:
  • filename – Name and path to the language file
  • languageName – Optional name to assign to the new language entry
Returns:

True If file was successfully found and language created

int LangTable::getCurrentLanguage()

Get the ID of the current language table.

Returns:Numerical ID of the current language table
string LangTable::getLangName(int language)

Return the readable name of the language table.

Parameters:language – Numerical ID of the language table to access
Returns:String containing the name of the table, NULL if ID was invalid or name was never specified
int LangTable::getNumLang()

Used to find out how many languages are in the table.

Returns:Size of the vector containing the languages, numerical
string LangTable::getString(string filename)

Grabs a string from the specified table. If an invalid is passed, the function will attempt to to grab from the default table

Parameters:filename – Name of the language table to access
Returns:Text from the specified language table, “” if ID was invalid and default table is not set
void LangTable::setCurrentLanguage(int language)

Sets the current language table for grabbing text.

Parameters:language – ID of the table
void LangTable::setDefaultLanguage(int language)

Sets the default language table.

Parameters:language – ID of the table