|
LangTable Class Reference
[Localization]
Provides the code necessary to handle the low level management of the string tables for localization. More...
Public Member Functions | |
int | addLanguage (string filename,[string languageName]) |
Adds a language to the table. | |
int | getCurrentLanguage () |
Get the ID of the current language table. | |
string | getLangName (int language) |
Return the readable name of the language table. | |
int | getNumLang () |
Used to find out how many languages are in the table. | |
string | getString (string filename) |
Grabs a string from the specified table. | |
void | setCurrentLanguage (int language) |
Sets the current language table for grabbing text. | |
void | setDefaultLanguage (int language) |
Sets the default language table. |
Detailed Description
Provides the code necessary to handle the low level management of the string tables for localization.
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.
- See also:
- Localization for a full description
Member Function Documentation
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