Make TX volatge for simu more flexible (#7124)
[opentx.git] / companion / src / translations.h
blob0099317edc533458ac7f0b38f711b20119a9cd59
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef TRANSLATIONS_H
22 #define TRANSLATIONS_H
24 #include <QString>
26 // Where to find translation files?
27 // First any path in environment variable OPENTX_APP_TRANSLATIONS_PATH is used if it exists.
29 // Default location for .qm files when NOT compiled into application (this is searched after OPENTX_APP_TRANSLATIONS_PATH).
30 #ifndef APP_TRANSLATIONS_FILE_PATH
31 #define APP_TRANSLATIONS_FILE_PATH QCoreApplication::applicationDirPath() % "/translations"
32 #endif
34 // Default location for .qm files when compiled into application as a resource (this is searched after APP_TRANSLATIONS_FILE_PATH) .
35 #ifndef APP_TRANSLATIONS_RESOURCE_PATH
36 #define APP_TRANSLATIONS_RESOURCE_PATH ":/translations"
37 #endif
39 class QLocale;
40 class QTranslator;
42 class Translations
44 public:
45 static QStringList const getTranslationPaths();
46 static QStringList const getAvailableTranslations();
47 static QStringList const getAvailableLanguages();
49 static void installTranslators();
51 protected:
52 static bool tryLoadTranslator(QTranslator * t, const QLocale & locale, const QString & baseFile, const QStringList & paths);
55 #endif // TRANSLATIONS_H