From a80b76343b93f89d83b14e55bf9736b0116c966f Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Sun, 2 Apr 2017 17:16:44 -0400 Subject: [PATCH] Added QT translator. --- glabels/glabels_main.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/glabels/glabels_main.cpp b/glabels/glabels_main.cpp index c443df6..45d65cb 100644 --- a/glabels/glabels_main.cpp +++ b/glabels/glabels_main.cpp @@ -18,12 +18,6 @@ * along with gLabels-qt. If not, see . */ - -#include -#include -#include -#include - #include "FileUtil.h" #include "Db.h" #include "MainWindow.h" @@ -31,6 +25,12 @@ #include "Merge/Factory.h" +#include +#include +#include +#include +#include + int main( int argc, char **argv ) { @@ -44,16 +44,23 @@ int main( int argc, char **argv ) // Setup translators // QLocale locale = QLocale::system(); - QString translationsDir = glabels::FileUtil::translationsDir().canonicalPath(); + QString qtTranslationsDir = QLibraryInfo::location( QLibraryInfo::TranslationsPath ); + QString myTranslationsDir = glabels::FileUtil::translationsDir().canonicalPath(); + QTranslator qtTranslator; + if ( qtTranslator.load( locale, "qt", "_", qtTranslationsDir ) ) + { + app.installTranslator(&qtTranslator); + } + QTranslator glabelsTranslator; - if ( glabelsTranslator.load( locale, "glabels", "_", translationsDir ) ) + if ( glabelsTranslator.load( locale, "glabels", "_", myTranslationsDir ) ) { app.installTranslator(&glabelsTranslator); } QTranslator templatesTranslator; - if ( templatesTranslator.load( locale, "templates", "_", translationsDir ) ) + if ( templatesTranslator.load( locale, "templates", "_", myTranslationsDir ) ) { app.installTranslator(&templatesTranslator); }