comparison 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
comparison
equal deleted inserted replaced
108:2004b41d4a59 109:79714c95a145
1 #ifndef __gui__locale_h
2 #define __gui__locale_h
3
4 #include <QLocale>
5 #include <QTranslator>
6 #include <vector>
7 #include <string>
8 #include <memory>
9
10 namespace Locale {
11
12 std::string GetLocaleFullName(const QLocale& locale);
13
14 class Locale {
15 public:
16 Locale();
17 Locale(const std::string& name);
18 QLocale GetLocale();
19 std::vector<QLocale> GetAvailableLocales();
20 void RefreshAvailableLocales(); // why would this ever be called?
21 bool IsLocaleAvailable(const QLocale& locale);
22 bool SetActiveLocale(const QLocale& locale);
23
24 private:
25 bool SwitchTranslator(QTranslator& translator, const QString& name);
26
27 QTranslator _translator;
28 QTranslator _translator_qt;
29 QLocale _locale;
30 std::vector<QLocale> _available_translations = {};
31 };
32
33 }
34
35 #endif // __gui__locale_h