Public Member Functions | |
const Lang * | getLangById (LangId langId) const |
Returns language object by language ID. | |
LangId | getLangId (const std::string &name) const |
Returns language identifier by language name. | |
std::string | getLangName (LangId langId) const |
Returns string with language name by language ID. | |
void | getSupportedLanguageNames (StringList &stringList) const |
Fills provided string list with names of supported languages. | |
bool | hasLanguage (const std::string &name) const |
Checks if language is supported. | |
LangManager () | |
The default constructor. | |
void | load (const std::string &dataDir) |
Fills language objects with initial data. | |
virtual | ~LangManager () |
The destructor. |
const Lang * LangManager::getLangById | ( | LangId | langId | ) | const [virtual] |
This method checks if provided language identifier is valid and returns a pointer to corresponding language object or NULL otherwise.
[in] | langId | The language identifier to get object by |
Implements AbstractLangIdResolver.
LangId LangManager::getLangId | ( | const std::string & | name | ) | const |
This method can be used to retrieve valid language identifier to distinguish languages in daemon code except configuration files processing.
[in] | name | The language name to get ID of |
std::string LangManager::getLangName | ( | LangId | langId | ) | const |
This method returns short string with language name. These names usually used in configuration files processing. The string returned by this method can be empty if provided language ID is not valid.
[in] | langId | The ID of the language to get name of |
void LangManager::getSupportedLanguageNames | ( | StringList & | stringList | ) | const |
This method lets you know which languages are currently supported by the server.
[out] | stringList | The string list to receive the result |
bool LangManager::hasLanguage | ( | const std::string & | name | ) | const |
This method must be used during configuration file processing to be sure if some language name is valid and corresponding language object is available.
[in] | name | Name of a language to check |
void LangManager::load | ( | const std::string & | dataDir | ) |
Language objects contain various data such as string constants and uses it in different language operations. In most cases this data cannot be included in source code directly because it contains UNICODE characters. This method loads all required structures for all available languages from files stored in the specified directory.
[in] | dataDir | The directory with data files |