Release 1.5 #39
@@ -1,6 +1,9 @@
|
||||
#include "advancedviewplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
#include <QBoxLayout>
|
||||
|
||||
#include "mainwindow.h"
|
||||
@@ -12,6 +15,20 @@ AdvancedViewPlugin::AdvancedViewPlugin(QObject *parent) :
|
||||
ZeiterfassungPlugin(parent)
|
||||
{
|
||||
qDebug() << "called";
|
||||
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(m_translator.load(QLocale(), QStringLiteral("advancedviewplugin"), QStringLiteral("_"), dir))
|
||||
{
|
||||
if(!QCoreApplication::installTranslator(&m_translator))
|
||||
{
|
||||
qWarning() << "could not install translation advancedviewplugin";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not load translation advancedviewplugin";
|
||||
}
|
||||
}
|
||||
|
||||
void AdvancedViewPlugin::attachTo(MainWindow &mainWindow)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define ADVANCEDVIEWPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "zeiterfassungplugin.h"
|
||||
|
||||
@@ -18,6 +19,9 @@ public:
|
||||
|
||||
// ZeiterfassungPlugin interface
|
||||
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QTranslator m_translator;
|
||||
};
|
||||
|
||||
#endif // ADVANCEDVIEWPLUGIN_H
|
||||
|
@@ -42,3 +42,8 @@ TRANSLATIONS += translations/advancedviewplugin_en.ts \
|
||||
OTHER_FILES += advancedviewplugin.json
|
||||
|
||||
include(../../lrelease.pri)
|
||||
|
||||
COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/advancedviewplugin_en.qm \
|
||||
$${OUT_PWD}/translations/advancedviewplugin_de.qm
|
||||
|
||||
include(../copy_translations.pri)
|
||||
|
6
plugins/copy_translations.pri
Normal file
6
plugins/copy_translations.pri
Normal file
@@ -0,0 +1,6 @@
|
||||
copy_compiled_translations.input = COMPILED_TRANSLATIONS
|
||||
copy_compiled_translations.output = $${OUT_PWD}/../../bin/translations/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
|
||||
copy_compiled_translations.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
|
||||
copy_compiled_translations.CONFIG += no_link
|
||||
QMAKE_EXTRA_COMPILERS += copy_compiled_translations
|
||||
PRE_TARGETDEPS += compiler_copy_compiled_translations_make_all
|
@@ -1,6 +1,9 @@
|
||||
#include "lunchmealplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
#include <QBoxLayout>
|
||||
|
||||
#include "mainwindow.h"
|
||||
@@ -12,6 +15,20 @@ LunchMealPlugin::LunchMealPlugin(QObject *parent) :
|
||||
ZeiterfassungPlugin(parent)
|
||||
{
|
||||
qDebug() << "called";
|
||||
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(m_translator.load(QLocale(), QStringLiteral("lunchmealplugin"), QStringLiteral("_"), dir))
|
||||
{
|
||||
if(!QCoreApplication::installTranslator(&m_translator))
|
||||
{
|
||||
qWarning() << "could not install translation lunchmealplugin";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not load translation lunchmealplugin";
|
||||
}
|
||||
}
|
||||
|
||||
void LunchMealPlugin::attachTo(MainWindow &mainWindow)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define LUNCHMEALPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "zeiterfassungplugin.h"
|
||||
|
||||
@@ -18,6 +19,9 @@ public:
|
||||
|
||||
// ZeiterfassungPlugin interface
|
||||
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QTranslator m_translator;
|
||||
};
|
||||
|
||||
#endif // LUNCHMEALPLUGIN_H
|
||||
|
@@ -32,3 +32,8 @@ TRANSLATIONS += translations/lunchmealplugin_en.ts \
|
||||
OTHER_FILES += lunchmealplugin.json
|
||||
|
||||
include(../../lrelease.pri)
|
||||
|
||||
COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/lunchmealplugin_en.qm \
|
||||
$${OUT_PWD}/translations/lunchmealplugin_de.qm
|
||||
|
||||
include(../copy_translations.pri)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#include "presenceplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
|
||||
#include "presencewidget.h"
|
||||
|
||||
@@ -8,6 +11,20 @@ PresencePlugin::PresencePlugin(QObject *parent) :
|
||||
ZeiterfassungPlugin(parent)
|
||||
{
|
||||
qDebug() << "called";
|
||||
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(m_translator.load(QLocale(), QStringLiteral("presenceplugin"), QStringLiteral("_"), dir))
|
||||
{
|
||||
if(!QCoreApplication::installTranslator(&m_translator))
|
||||
{
|
||||
qWarning() << "could not install translation presenceplugin";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not load translation presenceplugin";
|
||||
}
|
||||
}
|
||||
|
||||
void PresencePlugin::attachTo(MainWindow &mainWindow)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define PRESENCEPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "zeiterfassungplugin.h"
|
||||
|
||||
@@ -18,6 +19,9 @@ public:
|
||||
|
||||
// ZeiterfassungPlugin interface
|
||||
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QTranslator m_translator;
|
||||
};
|
||||
|
||||
#endif // PRESENCEPLUGIN_H
|
||||
|
@@ -30,3 +30,8 @@ TRANSLATIONS += translations/presenceplugin_en.ts \
|
||||
OTHER_FILES += presenceplugin.json
|
||||
|
||||
include(../../lrelease.pri)
|
||||
|
||||
COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/presenceplugin_en.qm \
|
||||
$${OUT_PWD}/translations/presenceplugin_de.qm
|
||||
|
||||
include(../copy_translations.pri)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#include "reportsplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
|
||||
#include "reportswidget.h"
|
||||
|
||||
@@ -8,6 +11,20 @@ ReportsPlugin::ReportsPlugin(QObject *parent) :
|
||||
ZeiterfassungPlugin(parent)
|
||||
{
|
||||
qDebug() << "called";
|
||||
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(m_translator.load(QLocale(), QStringLiteral("reportsplugin"), QStringLiteral("_"), dir))
|
||||
{
|
||||
if(!QCoreApplication::installTranslator(&m_translator))
|
||||
{
|
||||
qWarning() << "could not install translation reportsplugin";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not load translation reportsplugin";
|
||||
}
|
||||
}
|
||||
|
||||
void ReportsPlugin::attachTo(MainWindow &mainWindow)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define REPORTSPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "zeiterfassungplugin.h"
|
||||
|
||||
@@ -18,6 +19,9 @@ public:
|
||||
|
||||
// ZeiterfassungPlugin interface
|
||||
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QTranslator m_translator;
|
||||
};
|
||||
|
||||
#endif // REPORTSPLUGIN_H
|
||||
|
@@ -30,3 +30,8 @@ TRANSLATIONS += translations/reportsplugin_en.ts \
|
||||
OTHER_FILES += reportsplugin.json
|
||||
|
||||
include(../../lrelease.pri)
|
||||
|
||||
COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/reportsplugin_en.qm \
|
||||
$${OUT_PWD}/translations/reportsplugin_de.qm
|
||||
|
||||
include(../copy_translations.pri)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#include "updaterplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "zeiterfassungsettings.h"
|
||||
@@ -12,6 +15,20 @@ UpdaterPlugin::UpdaterPlugin(QObject *parent) :
|
||||
ZeiterfassungPlugin(parent)
|
||||
{
|
||||
qDebug() << "called";
|
||||
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(m_translator.load(QLocale(), QStringLiteral("updaterplugin"), QStringLiteral("_"), dir))
|
||||
{
|
||||
if(!QCoreApplication::installTranslator(&m_translator))
|
||||
{
|
||||
qWarning() << "could not install translation updaterplugin";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not load translation updaterplugin";
|
||||
}
|
||||
}
|
||||
|
||||
void UpdaterPlugin::attachTo(MainWindow &mainWindow)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define UPDATERPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "zeiterfassungplugin.h"
|
||||
|
||||
@@ -18,6 +19,9 @@ public:
|
||||
|
||||
// ZeiterfassungPlugin interface
|
||||
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QTranslator m_translator;
|
||||
};
|
||||
|
||||
#endif // UPDATERPLUGIN_H
|
||||
|
@@ -30,3 +30,8 @@ TRANSLATIONS += translations/updaterplugin_en.ts \
|
||||
OTHER_FILES += updaterplugin.json
|
||||
|
||||
include(../../lrelease.pri)
|
||||
|
||||
COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/updaterplugin_en.qm \
|
||||
$${OUT_PWD}/translations/updaterplugin_de.qm
|
||||
|
||||
include(../copy_translations.pri)
|
||||
|
@@ -1,6 +1,9 @@
|
||||
#include "weatherplugin.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
#include <QStatusBar>
|
||||
|
||||
#include "mainwindow.h"
|
||||
@@ -11,6 +14,20 @@ WeatherPlugin::WeatherPlugin(QObject *parent) :
|
||||
ZeiterfassungPlugin(parent)
|
||||
{
|
||||
qDebug() << "called";
|
||||
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(m_translator.load(QLocale(), QStringLiteral("weatherplugin"), QStringLiteral("_"), dir))
|
||||
{
|
||||
if(!QCoreApplication::installTranslator(&m_translator))
|
||||
{
|
||||
qWarning() << "could not install translation weatherplugin";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qWarning() << "could not load translation weatherplugin";
|
||||
}
|
||||
}
|
||||
|
||||
void WeatherPlugin::attachTo(MainWindow &mainWindow)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
#define WEATHERPLUGIN_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTranslator>
|
||||
|
||||
#include "zeiterfassungplugin.h"
|
||||
|
||||
@@ -16,6 +17,9 @@ public:
|
||||
|
||||
// ZeiterfassungPlugin interface
|
||||
void attachTo(MainWindow &mainWindow) Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
QTranslator m_translator;
|
||||
};
|
||||
|
||||
#endif // WEATHERPLUGIN_H
|
||||
|
@@ -30,3 +30,8 @@ TRANSLATIONS += translations/weatherplugin_en.ts \
|
||||
OTHER_FILES += weatherplugin.json
|
||||
|
||||
include(../../lrelease.pri)
|
||||
|
||||
COMPILED_TRANSLATIONS += $${OUT_PWD}/translations/weatherplugin_en.qm \
|
||||
$${OUT_PWD}/translations/weatherplugin_de.qm
|
||||
|
||||
include(../copy_translations.pri)
|
||||
|
@@ -34,14 +34,11 @@ struct {
|
||||
|
||||
QVector<ZeiterfassungPlugin*> plugins;
|
||||
|
||||
bool loadAndInstallTranslator(QTranslator &translator,
|
||||
const QLocale &locale,
|
||||
const QString &filename,
|
||||
const QString &prefix = QString(),
|
||||
const QString &directory = QString(),
|
||||
const QString &suffix = QString())
|
||||
bool loadAndInstallTranslator(QTranslator &translator, const QString &filename)
|
||||
{
|
||||
if(!translator.load(locale, filename, prefix, directory, suffix))
|
||||
static auto dir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
|
||||
if(!translator.load(QLocale(), filename, QStringLiteral("_"), dir))
|
||||
{
|
||||
qWarning() << "could not load translation" << filename;
|
||||
return false;
|
||||
@@ -79,13 +76,11 @@ bool loadTranslations(QSplashScreen &splashScreen, ZeiterfassungSettings &settin
|
||||
settings.setLanguage(dialog.language());
|
||||
}
|
||||
|
||||
QLocale locale(settings.language(), QLocale::Austria);
|
||||
QLocale::setDefault(locale);
|
||||
QLocale::setDefault(QLocale(settings.language(), QLocale::Austria));
|
||||
|
||||
auto translationsDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath(QStringLiteral("translations"));
|
||||
loadAndInstallTranslator(translators.qtTranslator, locale, QStringLiteral("qt"), QStringLiteral("_"), translationsDir);
|
||||
loadAndInstallTranslator(translators.zeiterfassungTranslator, locale, QStringLiteral("zeiterfassung"), QStringLiteral("_"), translationsDir);
|
||||
loadAndInstallTranslator(translators.zeiterfassunglibTranslator, locale, QStringLiteral("zeiterfassunglib"), QStringLiteral("_"), translationsDir);
|
||||
loadAndInstallTranslator(translators.qtTranslator, QStringLiteral("qt"));
|
||||
loadAndInstallTranslator(translators.zeiterfassungTranslator, QStringLiteral("zeiterfassung"));
|
||||
loadAndInstallTranslator(translators.zeiterfassunglibTranslator, QStringLiteral("zeiterfassunglib"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user