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

◆ 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::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.

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

◆ 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:
  • Sources/FreeCAD/src/Gui/Language/Translator.h
  • Sources/FreeCAD/src/Gui/Language/Translator.cpp