on xenial help sign in
load the Qt catalog to get the RTL value
commit07e3d7900cf837f36caae0e5d685e38f74582cae authorLukáš Tinkl <lukas.tinkl@canonical.com> dateThu 27 Oct 2016, 02:05 (10 years ago) parent29c2ac2
4 files changed+29−12
src/Dash/main.cpp+9−1 src/Panel/Indicators/client/indicatorsclient.cpp+10−8 src/Panel/Indicators/client/indicatorsclient.h−2 src/main.cpp+10−1
src/Dash/main.cpp+9−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
33 *
44 * Authors:
55 * Michael Zanetti <michael.zanetti@canonical.com>
@@ -26,6 +26,9 @@
2626#include <QLibrary>
2727#include <libintl.h>
2828#include <QQmlApplicationEngine>
29+#include <QTranslator>
30+#include <QLibraryInfo>
31+#include <QLocale>
2932
3033#include <paths.h>
3134#include "../qmldebuggerutils.h"
@@ -81,6 +84,11 @@ int main(int argc, const char *argv[])
8184 }
8285 }
8386
87+ QTranslator qtTranslator;
88+ if (qtTranslator.load(QLocale(), QStringLiteral("qt_"), qgetenv("SNAP"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
89+ application->installTranslator(&qtTranslator);
90+ }
91+
8492 bindtextdomain("unity8", translationDirectory().toUtf8().data());
8593 textdomain("unity8");
8694
src/Panel/Indicators/client/indicatorsclient.cpp+10−8
@@ -1,5 +1,5 @@
11/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013-2016 Canonical Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU Lesser General Public License as published by
@@ -26,6 +26,9 @@
2626#include <QQmlContext>
2727#include <QQmlEngine>
2828#include <QDebug>
29+#include <QTranslator>
30+#include <QLibraryInfo>
31+#include <QLocale>
2932
3033IndicatorsClient::IndicatorsClient(int &argc, char **argv)
3134 : QObject(0),
@@ -33,6 +36,11 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
3336{
3437 m_application = new QApplication(argc, argv);
3538
39+ QTranslator qtTranslator;
40+ if (qtTranslator.load(QLocale(), QStringLiteral("qt_"), qgetenv("SNAP"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
41+ m_application->installTranslator(&qtTranslator);
42+ }
43+
3644 QStringList args = m_application->arguments();
3745
3846 m_view = new QQuickView;
@@ -53,8 +61,7 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
5361 if (geometryArg.size() == 2) {
5462 m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
5563 }
56− }
57− else {
64+ } else {
5865 //Usable size on desktop
5966 m_view->setMinimumSize(QSize(480, 720));
6067 }
@@ -69,11 +76,6 @@ IndicatorsClient::~IndicatorsClient()
6976 delete m_application;
7077}
7178
72−void IndicatorsClient::setupUI()
73−{
74−
75−}
76−
7779int IndicatorsClient::run()
7880{
7981 m_view->show();
src/Panel/Indicators/client/indicatorsclient.h−2
@@ -38,8 +38,6 @@ public:
3838private:
3939 QApplication *m_application;
4040 QQuickView *m_view;
41−
42− void setupUI();
4341};
4442
4543#endif
src/main.cpp+10−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2012-2015 Canonical, Ltd.
2+ * Copyright (C) 2012-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,10 @@
1919#include "qmldebuggerutils.h"
2020#include "UnixSignalHandler.h"
2121
22+#include <QTranslator>
23+#include <QLibraryInfo>
24+#include <QLocale>
25+
2226int main(int argc, const char *argv[])
2327{
2428 qSetMessagePattern("[%{time yyyy-MM-dd:hh:mm:ss.zzz}] %{if-category}%{category}: %{endif}%{message}");
@@ -40,6 +44,11 @@ int main(int argc, const char *argv[])
4044 });
4145 signalHandler.setupUnixSignalHandlers();
4246
47+ QTranslator qtTranslator;
48+ if (qtTranslator.load(QLocale(), QStringLiteral("qt_"), qgetenv("SNAP"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
49+ application->installTranslator(&qtTranslator);
50+ }
51+
4352 int result = application->exec();
4453
4554 application->destroyResources();