Make displayMessages translatable

This commit is contained in:
Michael Zanetti 2019-09-17 12:23:48 +02:00
parent 82bebeccca
commit fe5af9a0f5
15 changed files with 1280 additions and 11685 deletions

View File

@ -55,6 +55,9 @@ QString Translator::translate(const PluginId &pluginId, const QString &string, c
QTranslator* translator = m_translatorContexts.value(plugin->pluginId()).translators.value(locale.name());
QString translatedString = translator->translate(plugin->pluginName().toUtf8(), string.toUtf8());
if (translatedString.isEmpty()) {
translatedString = translator->translate(plugin->metaObject()->className(), string.toUtf8());
}
return translatedString.isEmpty() ? string : translatedString;
}

View File

@ -37,10 +37,10 @@ QMAKE_EXTRA_TARGETS += licensecheck
# Translations:
# make lupdate to update .ts files
CORE_TRANSLATIONS += $$files($${top_srcdir}/translations/*.ts, true)
lupdate.commands = lupdate -recursive -no-obsolete $${top_srcdir} -ts $${CORE_TRANSLATIONS};
lupdate.commands = lupdate -no-obsolete -recursive $${top_srcdir}/libnymea $${top_srcdir}/libnymea-core $${top_srcdir}/server $${top_srcdir}/libnymea $${top_srcdir}/tools -ts $${CORE_TRANSLATIONS};
lupdate.commands += make -C plugins/mock plugininfo;
PLUGIN_TRANSLATIONS += $$files($${top_srcdir}/plugins/mock/translations/*.ts, true)
lupdate.commands += lupdate -recursive -no-obsolete $${top_builddir}/plugins/mock/ -ts $${PLUGIN_TRANSLATIONS};
lupdate.commands += lupdate -no-obsolete -recursive $${top_srcdir}/plugins/mock/ $${top_builddir}/plugins/mock/ -ts $${PLUGIN_TRANSLATIONS};
lupdate.depends = FORCE qmake_all
TRANSLATIONS = $${CORE_TRANSLATIONS} $${PLUGIN_TRANSLATIONS}

View File

@ -278,19 +278,21 @@ void DevicePluginMock::startMonitoringAutoDevices()
void DevicePluginMock::startPairing(DevicePairingInfo *info)
{
if (info->deviceClassId() == mockPushButtonDeviceClassId) {
qCDebug(dcMockDevice) << QString(tr("Push button. Pressing the button in 3 seconds."));
qCDebug(dcMockDevice) << "Push button. Pressing the button in 3 seconds.";
info->finish(Device::DeviceErrorNoError, QT_TR_NOOP("Wait 3 second before you continue, the push button will be pressed automatically."));
m_pushbuttonPressed = false;
QTimer::singleShot(3000, this, SLOT(onPushButtonPressed()));
return;
}
if (info->deviceClassId() == mockDisplayPinDeviceClassId) {
qCDebug(dcMockDevice) << QString(tr("Display pin!! The pin is 243681"));
qCDebug(dcMockDevice) << "Display pin!! The pin is 243681";
info->finish(Device::DeviceErrorNoError, QT_TR_NOOP("Please enter the secret which normaly will be displayed on the device. For the mockdevice the pin is 243681."));
return;
}
if (info->deviceClassId() == mockUserAndPassDeviceClassId) {
qCDebug(dcMockDevice) << QString(tr("User and password. Login is \"user\" and \"password\"."));
qCDebug(dcMockDevice) << "User and password. Login is \"user\" and \"password\".";
info->finish(Device::DeviceErrorNoError, QT_TR_NOOP("Please enter login credentials for the mock device (\"user\" and \"password\")."));
return;
}
@ -865,10 +867,6 @@ void DevicePluginMock::generateDiscoveredPushButtonDevices(DeviceDiscoveryInfo *
info->addDeviceDescriptor(d2);
}
info->finish(Device::DeviceErrorNoError, QT_TR_NOOP("This device will simulate a push button press in 3 seconds."));
m_pushbuttonPressed = false;
QTimer::singleShot(3000, this, SLOT(onPushButtonPressed()));
qCDebug(dcMockDevice) << "Start PushButton timer (will be pressed in 3 second)";
}
void DevicePluginMock::generateDiscoveredDisplayPinDevices(DeviceDiscoveryInfo *info)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff