#include <Translator.h>
singleton stuff | |
static Translator * | instance (void) |
Creates an instance. More... | |
static void | destruct (void) |
Destroys the instance. More... | |
void | activateLanguage (const char *lang) |
Activates the specified language lang if available. More... | |
void | refresh () |
This method checks for newly added (internal) .qm files which might be added at runtime. More... | |
std::string | activeLanguage () const |
Returns the currently installed language. More... | |
std::string | locale (const std::string &) const |
Returns the locale (e.g. More... | |
void | setLocale (const std::string &="") const |
Sets default Qt locale based on given language name. More... | |
TStringList | supportedLanguages () const |
Returns a list of supported languages. More... | |
TStringMap | supportedLocales () const |
Returns a map of supported languages/locales. More... | |
void | addPath (const QString &path) |
Adds a path where localization files can be found. More... | |
void Translator::activateLanguage | ( | const char * | lang | ) |
Activates the specified language lang if available.
References Gui::TranslatorP::activatedLanguage, DraftVecUtils::find(), refresh(), and supportedLanguages().
Referenced by Gui::Application::Application(), and Gui::Application::sSetLocale().
std::string Translator::activeLanguage | ( | ) | const |
Returns the currently installed language.
If no language is installed an empty string is returned.
References Gui::TranslatorP::activatedLanguage.
Referenced by Gui::Dialog::DlgGeneralImp::loadSettings(), Gui::Application::runApplication(), and Gui::Application::sGetLocale().
void Translator::addPath | ( | const QString & | path | ) |
Adds a path where localization files can be found.
References Gui::TranslatorP::paths.
Referenced by Gui::Application::sAddLangPath(), and Gui::Application::sAddResPath().
|
static |
Destroys the instance.
Referenced by Gui::Application::~Application().
|
static |
Creates an instance.
Referenced by Gui::Application::Application(), Gui::Dialog::DlgGeneralImp::loadSettings(), Gui::Application::runApplication(), Gui::Application::sAddLangPath(), Gui::Application::sAddResPath(), Gui::Application::sGetLocale(), Gui::Application::sSetLocale(), Gui::Application::sSupportedLocales(), and Gui::Application::sUpdateLocale().
std::string Translator::locale | ( | const std::string & | lang | ) | const |
Returns the locale (e.g.
"de") to the given language name.
References Gui::TranslatorP::mapLanguageTopLevelDomain.
Referenced by setLocale().
void Translator::refresh | ( | ) |
This method checks for newly added (internal) .qm files which might be added at runtime.
This e.g. happens if a plugin gets loaded at runtime. For each newly added files that supports the currently set language a new translator object is created to load the file.
References Gui::TranslatorP::activatedLanguage, Gui::TranslatorP::mapLanguageTopLevelDomain, and Gui::TranslatorP::paths.
Referenced by PathScripts.PathToolBitEdit.ToolBitEditor::accept(), PathScripts.PathToolEdit.ToolEditor::accept(), activateLanguage(), PathScripts.PathToolBitEdit.ToolBitEditor::setupUI(), PathScripts.PathToolControllerGui.ToolControllerEditor::setupUi(), PathScripts.PathToolEdit.ToolEditor::setupUI(), and Gui::Application::sUpdateLocale().
void Translator::setLocale | ( | const std::string & | language = "" | ) | const |
Sets default Qt locale based on given language name.
References Base::Console(), locale(), and Base::ConsoleSingleton::Log().
Referenced by Gui::Application::runApplication().
TStringList Translator::supportedLanguages | ( | ) | const |
Returns a list of supported languages.
References supportedLocales().
Referenced by activateLanguage().
TStringMap Translator::supportedLocales | ( | ) | const |
Returns a map of supported languages/locales.
References Gui::TranslatorP::mapLanguageTopLevelDomain, Gui::TranslatorP::mapSupportedLocales, and Gui::TranslatorP::paths.
Referenced by Gui::Dialog::DlgGeneralImp::loadSettings(), Gui::Application::sSetLocale(), Gui::Application::sSupportedLocales(), and supportedLanguages().