Mercurial > minori
diff include/gui/locale.h @ 109:79714c95a145
*: add translation files and locale files
I forgot to add these in the last commit :p
also now you have to ask cmake to update the translations
because before the ts files were not tracked (obviously)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Mon, 06 Nov 2023 01:51:44 -0500 |
parents | |
children | 39521c47c7a3 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/gui/locale.h Mon Nov 06 01:51:44 2023 -0500 @@ -0,0 +1,35 @@ +#ifndef __gui__locale_h +#define __gui__locale_h + +#include <QLocale> +#include <QTranslator> +#include <vector> +#include <string> +#include <memory> + +namespace Locale { + +std::string GetLocaleFullName(const QLocale& locale); + +class Locale { +public: + Locale(); + Locale(const std::string& name); + QLocale GetLocale(); + std::vector<QLocale> GetAvailableLocales(); + void RefreshAvailableLocales(); // why would this ever be called? + bool IsLocaleAvailable(const QLocale& locale); + bool SetActiveLocale(const QLocale& locale); + +private: + bool SwitchTranslator(QTranslator& translator, const QString& name); + + QTranslator _translator; + QTranslator _translator_qt; + QLocale _locale; + std::vector<QLocale> _available_translations = {}; +}; + +} + +#endif // __gui__locale_h