add guh-translations package

pull/135/head
Simon Stürz 2016-08-17 19:26:09 +02:00 committed by Michael Zanetti
parent 1a74e9c1fe
commit d3abd9bf9f
14 changed files with 41 additions and 23 deletions

19
debian/control vendored
View File

@ -19,7 +19,7 @@ Standards-Version: 3.9.5
Package: guh
Architecture: any
Section: misc
Section: metapackages
Depends: guhd (= ${binary:Version}),
guh-plugins (= ${binary:Version}),
Description: An open source IoT server - meta package
@ -31,6 +31,7 @@ Description: An open source IoT server - meta package
Package: guhd
Architecture: any
Section: net
Depends: libqt5network5,
libqt5gui5,
libqt5sql5,
@ -39,6 +40,7 @@ Depends: libqt5network5,
libqt5bluetooth5,
logrotate,
avahi-daemon,
guh-translations (= ${binary:Version}),
libguh1 (= ${binary:Version}),
${shlibs:Depends},
${misc:Depends}
@ -73,12 +75,25 @@ Description: Documentation for the guh package (on-site) - documentation
powerful rule engine you are able to connect any device available in
the system and create individual scenes and behaviors for your home.
Package: guh-translations
Section: translations
Architecture: all
Depends: guh (= ${binary:Version}),
${misc:Depends}
Recommends: guh (= ${binary:Version})
Description: Documentation for the guh package (on-site) - documentation
guh is an open source home automation server, which allows to control
a lot of different devices from many different manufacturers. With the
powerful rule engine you are able to connect any device available in
the system and create individual scenes and behaviors for your home.
Package: guh-tests
Section: misc
Architecture: any
Depends: guh (= ${binary:Version}),
${shlibs:Depends},
${misc:Depends}
Description: Tests and mock plugin for the guh package
Description: Translation files for guh - translations
guh is an open source IoT (Internet of Things) server,
which allows to control a lot of different devices from many different
manufacturers. With the powerful rule engine you are able to connect any

View File

@ -1,2 +1 @@
usr/lib/guh/plugins
usr/share/guh/translations

View File

@ -1,2 +1 @@
usr/lib/guh/plugins
usr/share/guh/translations

View File

@ -1,2 +1 @@
usr/lib/guh/plugins
usr/share/guh/translations

1
debian/guh-translations.dirs vendored Normal file
View File

@ -0,0 +1 @@
usr/share/guh/translations

2
debian/guh-translations.install vendored Normal file
View File

@ -0,0 +1,2 @@
translations/*.qm usr/share/guh/translations

1
debian/guhd.dirs vendored
View File

@ -1,3 +1,2 @@
usr/bin
etc/guh/
usr/share/guh/translations

1
debian/guhd.install vendored
View File

@ -1,4 +1,3 @@
usr/bin/guhd
data/systemd/guhd.service /etc/systemd/system/
data/logrotate/guhd /etc/logrotate.d/
translations/*.qm /usr/share/guh/translations

View File

@ -286,9 +286,9 @@ void DeviceManager::setLocale(const QLocale &locale)
{
m_locale = locale;
foreach (DevicePlugin *plugin, m_devicePlugins.values()) {
if (!plugin->setLocale(m_locale))
qCWarning(dcDeviceManager()) << "Could not load translation" << m_locale.name() << "for plugin" << plugin->pluginName();
QCoreApplication::removeTranslator(plugin->translator());
plugin->setLocale(m_locale);
QCoreApplication::installTranslator(plugin->translator());
}
}

View File

@ -451,7 +451,7 @@ QTranslator *DevicePlugin::translator()
bool DevicePlugin::setLocale(const QLocale &locale)
{
// check if there are local translations
if (m_translator->load(locale, m_metaData.value("id").toString(), "-", QDir(QCoreApplication::applicationDirPath() + "../../plugins/translations/").absolutePath(), ".qm")) {
if (m_translator->load(locale, m_metaData.value("id").toString(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm")) {
qCDebug(dcDeviceManager()) << "* Load translation" << locale.name() << "for" << pluginName() << "from" << QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath();
return true;
}
@ -462,6 +462,7 @@ bool DevicePlugin::setLocale(const QLocale &locale)
return true;
}
qCWarning(dcDeviceManager()) << "* Could not load translation" << locale.name() << "for plugin" << pluginName();
return false;
}

View File

@ -23,7 +23,7 @@ infofile.commands = $$top_srcdir/plugins/guh-generateplugininfo -j ${QMAKE_FILE_
-o ${QMAKE_FILE_OUT} \
-b $$OUT_PWD \
-t $$TRANSLATIONS; \
rsync -a "$$OUT_PWD"/translations/*.qm $$top_builddir/plugins/translations/;
rsync -a "$$OUT_PWD"/translations/*.qm $$top_builddir/translations/;
QMAKE_EXTRA_COMPILERS += infofile
PRE_TARGETDEPS += compiler_infofile_make_all

View File

@ -132,7 +132,11 @@ int main(int argc, char *argv[])
// Translator for the server application
QTranslator translator;
translator.load(QLocale::system(), application.applicationName(), "_", GuhSettings::translationsPath(), ".qm");
// check if there are local translations
if (!translator.load(QLocale::system(), application.applicationName(), "-", QDir(QCoreApplication::applicationDirPath() + "../../translations/").absolutePath(), ".qm"))
if (!translator.load(QLocale::system(), application.applicationName(), "-", GuhSettings::translationsPath(), ".qm"))
qWarning(dcApplication()) << "Could not find guhd translations for" << QLocale::system();
qApp->installTranslator(&translator);
QCommandLineParser parser;

View File

@ -4,7 +4,7 @@
<context>
<name>main</name>
<message>
<location filename="../server/main.cpp" line="141"/>
<location filename="../server/main.cpp" line="145"/>
<source>
guh ( /[guːh]/ ) is an open source IoT (Internet of Things) server,
which allows to control a lot of different devices from many different
@ -23,12 +23,12 @@ Szenen undVerhaltensweisen des Systems festzulegen.
</translation>
</message>
<message>
<location filename="../server/main.cpp" line="153"/>
<location filename="../server/main.cpp" line="157"/>
<source>Run guhd in the foreground, not as daemon.</source>
<translation>Starte guhd im Vordergrund, nicht als Service.</translation>
</message>
<message>
<location filename="../server/main.cpp" line="156"/>
<location filename="../server/main.cpp" line="160"/>
<source>Debug categories to enable. Prefix with &quot;No&quot; to disable. Warnings from all categories will be printed unless explicitly muted with &quot;NoWarnings&quot;.
Categories are:</source>
@ -36,12 +36,12 @@ Categories are:</source>
Es gibt folgende Kategorien:</translation>
</message>
<message>
<location filename="../server/main.cpp" line="173"/>
<location filename="../server/main.cpp" line="177"/>
<source>Enables all debug categories. This parameter overrides all debug category parameters.</source>
<translation>Aktiviere alle Debug-Kategorien. Dieser Parameter überschreibt alle anderen Debug-Kategorien Parameter.</translation>
</message>
<message>
<location filename="../server/main.cpp" line="193"/>
<location filename="../server/main.cpp" line="197"/>
<source>No such debug category:</source>
<translation>Diese Debug-Kategorie existiert nicht:</translation>
</message>

View File

@ -4,7 +4,7 @@
<context>
<name>main</name>
<message>
<location filename="../server/main.cpp" line="141"/>
<location filename="../server/main.cpp" line="145"/>
<source>
guh ( /[guːh]/ ) is an open source IoT (Internet of Things) server,
which allows to control a lot of different devices from many different
@ -16,24 +16,24 @@ for your environment.
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../server/main.cpp" line="153"/>
<location filename="../server/main.cpp" line="157"/>
<source>Run guhd in the foreground, not as daemon.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../server/main.cpp" line="156"/>
<location filename="../server/main.cpp" line="160"/>
<source>Debug categories to enable. Prefix with &quot;No&quot; to disable. Warnings from all categories will be printed unless explicitly muted with &quot;NoWarnings&quot;.
Categories are:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../server/main.cpp" line="173"/>
<location filename="../server/main.cpp" line="177"/>
<source>Enables all debug categories. This parameter overrides all debug category parameters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../server/main.cpp" line="193"/>
<location filename="../server/main.cpp" line="197"/>
<source>No such debug category:</source>
<translation type="unfinished"></translation>
</message>