|
wiRedPanda
Logic Circuit Simulator
|
Owns the application QTranslator instances and provides language metadata. More...
#include <LanguageManager.h>
Public Member Functions | |
| QStringList | availableLanguages () const |
| Returns all available translation language codes, sorted, with "en" first. | |
| QString | displayName (const QString &langCode) const |
| Returns the native display name for langCode (e.g. "Deutsch" for "de"). | |
| QString | flagIcon (const QString &langCode) const |
| Returns the flag icon resource path for langCode. | |
| LanguageManager (QObject *parent=nullptr) | |
| void | loadTranslation (const QString &language) |
| Loads and installs the Qt translation for language. | |
| void | translationChanged () |
| Emitted after a translation has been successfully loaded (or reset to English). | |
| ~LanguageManager () override | |
Owns the application QTranslator instances and provides language metadata.
Encapsulates all translation concerns: discovering available .qm files, loading/unloading QTranslator objects, and mapping language codes to display names and flag icon resource paths. Emits translationChanged() after each successful load so the UI can retranslate itself.
Definition at line 24 of file LanguageManager.h.
|
explicit |
Definition at line 39 of file LanguageManager.cpp.
|
override |
Definition at line 48 of file LanguageManager.cpp.
References Application::instance().
| QStringList LanguageManager::availableLanguages | ( | ) | const |
Returns all available translation language codes, sorted, with "en" first.
Definition at line 97 of file LanguageManager.cpp.
| QString LanguageManager::displayName | ( | const QString & | langCode | ) | const |
Returns the native display name for langCode (e.g. "Deutsch" for "de").
| langCode | BCP-47 language code. |
Definition at line 136 of file LanguageManager.cpp.
| QString LanguageManager::flagIcon | ( | const QString & | langCode | ) | const |
Returns the flag icon resource path for langCode.
| langCode | BCP-47 language code. |
Definition at line 171 of file LanguageManager.cpp.
| void LanguageManager::loadTranslation | ( | const QString & | language | ) |
Loads and installs the Qt translation for language.
Falls back to English if the .qm file is missing or fails to load. Emits translationChanged() after the translators are installed.
| language | BCP-47 language code (e.g. "en", "pt_BR"). |
Definition at line 54 of file LanguageManager.cpp.
References Application::instance(), loadTranslation(), Settings::setLanguage(), and translationChanged().
Referenced by loadTranslation().
| void LanguageManager::translationChanged | ( | ) |
Emitted after a translation has been successfully loaded (or reset to English).
Referenced by loadTranslation().