summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorChristoph Berg <christoph.berg@credativ.de>2019-07-17 15:12:32 +0200
committerChristoph Berg <christoph.berg@credativ.de>2019-07-17 15:12:32 +0200
commit3d67be3023bf34eac7f93fa422f5ef569abb92a9 (patch)
treef3748d6a113c50d483882b60b732a9d211100cf8 /main.cpp
parent62c0c627f4f8aec46a082bf098d4f1523a16d297 (diff)
New upstream version 2.1.0+repackupstream/2.1.0+repack
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 9070ce33..fc791ade 100644
--- a/main.cpp
+++ b/main.cpp
@@ -10,6 +10,7 @@
#include <QTemporaryFile>
#include <QDateTime>
#include <QApplication>
+#include <QTranslator>
#include <QRegularExpression>
#include <QObject>
#include <QSettings>
@@ -106,6 +107,34 @@ int main(int argc, char *argv[])
ExceptionCatchingApplication a(argc, argv);
try
{
+ //
+ // Enable i18n
+ //
+ QTranslator translator_from_resources;
+ // Default translations for releases use translations stored in
+ // the resources file system under the Translations
+ // directory. These are built by the CMake build system from .ts
+ // files in the translations source directory. New languages are
+ // added by enabling the UPDATE_TRANSLATIONS CMake option and
+ // building with the new language added to the LANGUAGES CMake
+ // list variable. UPDATE_TRANSLATIONS will preserve existing
+ // translations but should only be set when adding new
+ // languages. The resulting .ts files should be checked info
+ // source control for translators to access and update.
+ translator_from_resources.load (QLocale::system (), "wsjtx", "_", ":/Translations");
+ a.installTranslator (&translator_from_resources);
+
+ QTranslator translator_from_files;
+ // Load any matching translation from the current directory
+ // using the locale name. This allows translators to easily test
+ // their translations by releasing (lrelease) a .qm file into
+ // the current directory with a suitable name
+ // (e.g. wsjtx_en_GB.qm), then running wsjtx to view the
+ // results. Either the system locale setting or the environment
+ // variable LANG can be used to select the target language.
+ translator_from_files.load (QString {"wsjtx_"} + QLocale::system ().name ());
+ a.installTranslator (&translator_from_files);
+
setlocale (LC_NUMERIC, "C"); // ensure number forms are in
// consistent format, do this after
// instantiating QApplication so