Mercurial > minori
annotate 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 |
rev | line source |
---|---|
109
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
1 #ifndef __gui__locale_h |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
2 #define __gui__locale_h |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
3 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
4 #include <QLocale> |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
5 #include <QTranslator> |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
6 #include <vector> |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
7 #include <string> |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
8 #include <memory> |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
9 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
10 namespace Locale { |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
11 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
12 std::string GetLocaleFullName(const QLocale& locale); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
13 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
14 class Locale { |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
15 public: |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
16 Locale(); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
17 Locale(const std::string& name); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
18 QLocale GetLocale(); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
19 std::vector<QLocale> GetAvailableLocales(); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
20 void RefreshAvailableLocales(); // why would this ever be called? |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
21 bool IsLocaleAvailable(const QLocale& locale); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
22 bool SetActiveLocale(const QLocale& locale); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
23 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
24 private: |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
25 bool SwitchTranslator(QTranslator& translator, const QString& name); |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
26 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
27 QTranslator _translator; |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
28 QTranslator _translator_qt; |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
29 QLocale _locale; |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
30 std::vector<QLocale> _available_translations = {}; |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
31 }; |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
32 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
33 } |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
34 |
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
35 #endif // __gui__locale_h |