mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
15ca7a587f
qTox can now retranslate its GUI dynamically, without needing a restart Fixes #1671 Closes #1672
28 lines
660 B
C++
28 lines
660 B
C++
#ifndef TRANSLATOR_H
|
|
#define TRANSLATOR_H
|
|
|
|
#include <QVector>
|
|
#include <QPair>
|
|
#include <QMutex>
|
|
#include <functional>
|
|
|
|
class QTranslator;
|
|
|
|
class Translator
|
|
{
|
|
public:
|
|
/// Loads the translations according to the settings or locale
|
|
static void translate();
|
|
/// Register a function to be called when the UI needs to be retranslated
|
|
static void registerHandler(std::function<void()>, void* owner);
|
|
/// Unregisters all handlers of an owner
|
|
static void unregister(void* owner);
|
|
|
|
private:
|
|
static QTranslator* translator;
|
|
static QVector<QPair<void*, std::function<void()>>> callbacks;
|
|
static QMutex lock;
|
|
};
|
|
|
|
#endif // TRANSLATOR_H
|