Gui::Translator Class Reference

#include <Translator.h>

singleton stuff

static Translatorinstance (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...

Member Function Documentation

◆ activateLanguage()

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().

◆ activeLanguage()

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().

◆ addPath()

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().

◆ destruct()

void Translator::destruct ( void  )

Destroys the instance.

Referenced by Gui::Application::~Application().

◆ instance()

◆ locale()

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().

◆ refresh()

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().

◆ setLocale()

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().

◆ supportedLanguages()

TStringList Translator::supportedLanguages ( ) const

Returns a list of supported languages.

References supportedLocales().

Referenced by activateLanguage().

◆ supportedLocales()

The documentation for this class was generated from the following files: