1#ifndef TRANSLATION_MANAGER_H
2#define TRANSLATION_MANAGER_H
42 QString
Translate(
const QString &key,
const QString &default_value = QString())
const;
TranslationManager & operator=(const TranslationManager &)=delete
Removed assignment constructor.
static TranslationManager * GetInstance()
Returns an instance of the TranslationManager singleton.
Definition translation_manager.cpp:26
static QMutex mutex_
Mutex to protect instance creation in a multithreaded environment.
Definition translation_manager.h:74
bool Initialize(const QString &language_code)
Initializes the translation manager by loading the appropriate language file.
Definition translation_manager.cpp:6
bool initialized_
A flag indicating whether the manager has been initialized.
Definition translation_manager.h:80
QString GetCurrentLanguage() const
Returns the currently loaded language code.
Definition translation_manager.cpp:69
bool LoadTranslations(const QString &language_code)
Loads translations from a JSON file for the specified language code.
Definition translation_manager.cpp:73
QString Translate(const QString &key, const QString &default_value=QString()) const
Retrieves the translated string for the specified key.
Definition translation_manager.cpp:34
QString current_language_code_
Currently loaded language code.
Definition translation_manager.h:78
static TranslationManager * instance_
Static singleton instance.
Definition translation_manager.h:72
TranslationManager(const TranslationManager &)=delete
Removed copy constructor.
TranslationManager(QObject *parent=nullptr)
Private constructor to enforce the singleton pattern.
Definition translation_manager.h:55
QJsonObject translations_
It stores the loaded translations as a JSON object.
Definition translation_manager.h:76