on xenial help sign in
load the Qt catalog to get the RTL value
07e3d79Lukáš Tinkl
src/Dash/main.cpp+9−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2016 Canonical, Ltd.
3 *
3 *
4 * Authors:
4 * Authors:
5 * Michael Zanetti <michael.zanetti@canonical.com>
5 * Michael Zanetti <michael.zanetti@canonical.com>
@@ -26,6 +26,9 @@
26#include <QLibrary>
26#include <QLibrary>
27#include <libintl.h>
27#include <libintl.h>
28#include <QQmlApplicationEngine>
28#include <QQmlApplicationEngine>
29+#include <QTranslator>
30+#include <QLibraryInfo>
31+#include <QLocale>
29
32
30#include <paths.h>
33#include <paths.h>
31#include "../qmldebuggerutils.h"
34#include "../qmldebuggerutils.h"
@@ -81,6 +84,11 @@ int main(int argc, const char *argv[])
81 }
84 }
82 }
85 }
83
86
87+ QTranslator qtTranslator;
88+ if (qtTranslator.load(QLocale(), QStringLiteral("qt_"), qgetenv("SNAP"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
89+ application->installTranslator(&qtTranslator);
90+ }
91+
84 bindtextdomain("unity8", translationDirectory().toUtf8().data());
92 bindtextdomain("unity8", translationDirectory().toUtf8().data());
85 textdomain("unity8");
93 textdomain("unity8");
86
94
src/Panel/Indicators/client/indicatorsclient.cpp+10−8
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright 2013 Canonical Ltd.
2+ * Copyright 2013-2016 Canonical Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
5 * it under the terms of the GNU Lesser General Public License as published by
@@ -26,6 +26,9 @@
26#include <QQmlContext>
26#include <QQmlContext>
27#include <QQmlEngine>
27#include <QQmlEngine>
28#include <QDebug>
28#include <QDebug>
29+#include <QTranslator>
30+#include <QLibraryInfo>
31+#include <QLocale>
29
32
30IndicatorsClient::IndicatorsClient(int &argc, char **argv)
33IndicatorsClient::IndicatorsClient(int &argc, char **argv)
31 : QObject(0),
34 : QObject(0),
@@ -33,6 +36,11 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
33{
36{
34 m_application = new QApplication(argc, argv);
37 m_application = new QApplication(argc, argv);
35
38
39+ QTranslator qtTranslator;
40+ if (qtTranslator.load(QLocale(), QStringLiteral("qt_"), qgetenv("SNAP"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
41+ m_application->installTranslator(&qtTranslator);
42+ }
43+
36 QStringList args = m_application->arguments();
44 QStringList args = m_application->arguments();
37
45
38 m_view = new QQuickView;
46 m_view = new QQuickView;
@@ -53,8 +61,7 @@ IndicatorsClient::IndicatorsClient(int &argc, char **argv)
53 if (geometryArg.size() == 2) {
61 if (geometryArg.size() == 2) {
54 m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
62 m_view->resize(geometryArg.at(0).toInt(), geometryArg.at(1).toInt());
55 }
63 }
56− }
57− else {
64+ } else {
58 //Usable size on desktop
65 //Usable size on desktop
59 m_view->setMinimumSize(QSize(480, 720));
66 m_view->setMinimumSize(QSize(480, 720));
60 }
67 }
@@ -69,11 +76,6 @@ IndicatorsClient::~IndicatorsClient()
69 delete m_application;
76 delete m_application;
70}
77}
71
78
72−void IndicatorsClient::setupUI()
73−{
74−
75−}
76−
77int IndicatorsClient::run()
79int IndicatorsClient::run()
78{
80{
79 m_view->show();
81 m_view->show();
src/Panel/Indicators/client/indicatorsclient.h−2
@@ -38,8 +38,6 @@ public:
38private:
38private:
39 QApplication *m_application;
39 QApplication *m_application;
40 QQuickView *m_view;
40 QQuickView *m_view;
41−
42− void setupUI();
43};
41};
44
42
45#endif
43#endif
src/main.cpp+10−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2012-2015 Canonical, Ltd.
2+ * Copyright (C) 2012-2016 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -19,6 +19,10 @@
19#include "qmldebuggerutils.h"
19#include "qmldebuggerutils.h"
20#include "UnixSignalHandler.h"
20#include "UnixSignalHandler.h"
21
21
22+#include <QTranslator>
23+#include <QLibraryInfo>
24+#include <QLocale>
25+
22int main(int argc, const char *argv[])
26int main(int argc, const char *argv[])
23{
27{
24 qSetMessagePattern("[%{time yyyy-MM-dd:hh:mm:ss.zzz}] %{if-category}%{category}: %{endif}%{message}");
28 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[])
40 });
44 });
41 signalHandler.setupUnixSignalHandlers();
45 signalHandler.setupUnixSignalHandlers();
42
46
47+ QTranslator qtTranslator;
48+ if (qtTranslator.load(QLocale(), QStringLiteral("qt_"), qgetenv("SNAP"), QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
49+ application->installTranslator(&qtTranslator);
50+ }
51+
43 int result = application->exec();
52 int result = application->exec();
44
53
45 application->destroyResources();
54 application->destroyResources();