#include <translation.h>
Public Member Functions | |
TranslationManager (const Common::String &fileName) | |
String | getLangById (int id) const |
void | setLanguage (const String &lang) |
void | setLanguage (int id) |
int | parseLanguage (const String &lang) const |
U32String | getTranslation (const char *message) const |
U32String | getTranslation (const String &message) const |
U32String | getTranslation (const char *message, const char *context) const |
U32String | getTranslation (const String &message, const String &context) const |
const TLangArray | getSupportedLanguageNames () const |
String | getCurrentLanguage () const |
int | getCurrentLanguageId () const |
bool | currentIsBuiltinLanguage () const |
Message translation manager.
Common::TranslationManager::TranslationManager | ( | const Common::String & | fileName | ) |
Constructor that sets the current language to the default language.
The default language is the detected system language.
String Common::TranslationManager::getLangById | ( | int | id | ) | const |
Retrieve the language string from the given ID.
id | ID of the language. |
void Common::TranslationManager::setLanguage | ( | const String & | lang | ) |
Set the current translation language to the one specified in the parameter.
If the parameter is an empty string, it sets the translation language to the default system language.
lang | Language to set up. |
|
inline |
Set the current translation language to the one specified by the id
parameter.
id | ID of the language. |
int Common::TranslationManager::parseLanguage | ( | const String & | lang | ) | const |
Get the ID for the given language string.
lang | Language string. |
U32String Common::TranslationManager::getTranslation | ( | const char * | message | ) | const |
Return the translation of message
into the current language.
In case the message is not found in the translation catalog, return the original untranslated message, as a U32String.
Return the translation of message
into the current language.
In case the message is not found in the translation catalog, return the original untranslated message, as a U32String.
U32String Common::TranslationManager::getTranslation | ( | const char * | message, |
const char * | context | ||
) | const |
Return the translation of message
into the current language.
In case the message is not found in the translation catalog, return the original untranslated message, as a U32String.
If a translation is found for the given context, return that translation. Otherwise, look for a translation for the same message without a context or with a different context.
U32String Common::TranslationManager::getTranslation | ( | const String & | message, |
const String & | context | ||
) | const |
Return the translation of message
into the current language.
In case the message is not found in the translation catalog, return the original untranslated message, as a U32String.
If a translation is found for the given context, return that translation. Otherwise, look for a translation for the same message without a context or with a different context.
const TLangArray Common::TranslationManager::getSupportedLanguageNames | ( | ) | const |
Return a list of supported languages.
String Common::TranslationManager::getCurrentLanguage | ( | ) | const |
Return the currently selected translation language.
int Common::TranslationManager::getCurrentLanguageId | ( | ) | const |
Return the id of the selected translation language.
bool Common::TranslationManager::currentIsBuiltinLanguage | ( | ) | const |
Return true if the current language is the builtin language and false if it is another language.