LangTable
Provides the code necessary to handle the low level management of the string tables for localization.
Public Functions
int
addLanguage(String filename, String languageName)
Adds a language to the table.
int
Get the ID of the current language table.
string
getLangName(int langId)
Return the readable name of the language table.
int
Used to find out how many languages are in the table.
string
getString(uint id)
Grabs a string from the specified table.
void
setCurrentLanguage(int langId)
Sets the current language table for grabbing text.
void
setDefaultLanguage(int langId)
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.
Localization for a full description
Public Functions
addLanguage(String filename, String languageName)
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 |
True If file was successfully found and language created
getCurrentLanguage()
Get the ID of the current language table.
Numerical ID of the current language table
getLangName(int langId)
Return the readable name of the language table.
Parameters:
language | Numerical ID of the language table to access |
String containing the name of the table, NULL if ID was invalid or name was never specified
getNumLang()
Used to find out how many languages are in the table.
Size of the vector containing the languages, numerical
getString(uint id)
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 |
Text from the specified language table, "" if ID was invalid and default table is not set
setCurrentLanguage(int langId)
Sets the current language table for grabbing text.
Parameters:
language | ID of the table |
setDefaultLanguage(int langId)
Sets the default language table.
Parameters:
language | ID of the table |