From 318a71725f28a52d5f2099e2775711b503da0cce Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 4 May 2020 13:39:20 +0200 Subject: [PATCH] Fix plugins translations --- libnymea-core/integrations/translator.cpp | 2 +- plugins/mock/extern-plugininfo.h | 1 + plugins/mock/integrationpluginmock.json | 9 ++ plugins/mock/plugininfo.h | 4 + ...27a4a9a-c187-446f-aadf-f1b2220607d1-de.ts} | 123 +++++++++--------- ...a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts | 31 +++-- tests/auto/integrations/testintegrations.cpp | 82 ++++++++++++ translations/nymead-cs.ts | 2 +- translations/nymead-da.ts | 2 +- .../{nymead-de_DE.ts => nymead-de.ts} | 14 +- translations/nymead-en_US.ts | 2 +- translations/nymead-es.ts | 2 +- translations/nymead-fi.ts | 2 +- translations/nymead-fr.ts | 2 +- translations/nymead-it.ts | 2 +- translations/nymead-nl.ts | 2 +- translations/nymead-pt.ts | 2 +- 17 files changed, 195 insertions(+), 89 deletions(-) rename plugins/mock/translations/{727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts => 727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts} (93%) rename translations/{nymead-de_DE.ts => nymead-de.ts} (98%) diff --git a/libnymea-core/integrations/translator.cpp b/libnymea-core/integrations/translator.cpp index 4b56c1bc..0faac5f1 100644 --- a/libnymea-core/integrations/translator.cpp +++ b/libnymea-core/integrations/translator.cpp @@ -108,7 +108,7 @@ void Translator::loadTranslator(IntegrationPlugin *plugin, const QLocale &locale break; } foreach (const QString &subdir, QDir(pluginPath).entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { -// qCDebug(dcTranslations()) << "|- Searching for translations for" << plugin->pluginName() << "in subdir" << QDir(pluginPath + "/" + subdir + "/translations/").absolutePath() << locale << pluginId; + qCDebug(dcTranslations()) << "|- Searching for translations for" << plugin->pluginName() << "in subdir" << QDir(pluginPath + "/" + subdir + "/translations/").absolutePath() << locale << pluginId; if (translator->load(locale, pluginId, "-", QDir(pluginPath + "/" + subdir + "/translations/").absolutePath(), ".qm")) { qCDebug(dcTranslations()) << "* Loaded translation" << locale.name() << "for plugin" << plugin->pluginName() << "from" << QDir(pluginPath + "/" + subdir + "/translations/").absolutePath() + "/" + pluginId + "-[" + locale.name() + "].qm"; loaded = true; diff --git a/plugins/mock/extern-plugininfo.h b/plugins/mock/extern-plugininfo.h index 79b79c29..e562c819 100644 --- a/plugins/mock/extern-plugininfo.h +++ b/plugins/mock/extern-plugininfo.h @@ -56,6 +56,7 @@ extern ThingClassId autoMockThingClassId; extern ParamTypeId autoMockThingHttpportParamTypeId; extern ParamTypeId autoMockThingAsyncParamTypeId; extern ParamTypeId autoMockThingBrokenParamTypeId; +extern ParamTypeId autoMockSettingsMockSettingParamTypeId; extern StateTypeId autoMockIntStateTypeId; extern StateTypeId autoMockBoolValueStateTypeId; extern EventTypeId autoMockIntEventTypeId; diff --git a/plugins/mock/integrationpluginmock.json b/plugins/mock/integrationpluginmock.json index b590e091..8ad3fcf4 100644 --- a/plugins/mock/integrationpluginmock.json +++ b/plugins/mock/integrationpluginmock.json @@ -237,6 +237,15 @@ "defaultValue": false } ], + "settingsTypes": [ + { + "id": "da0b9106-03cf-4631-87e9-26ade3360182", + "name": "mockSetting", + "displayName": "Mock setting", + "type": "int", + "defaultValue": 5 + } + ], "stateTypes": [ { "id": "74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c", diff --git a/plugins/mock/plugininfo.h b/plugins/mock/plugininfo.h index 5bf42599..d1e36aab 100644 --- a/plugins/mock/plugininfo.h +++ b/plugins/mock/plugininfo.h @@ -60,6 +60,7 @@ ThingClassId autoMockThingClassId = ThingClassId("{ab4257b3-7548-47ee-9bd4-7dc30 ParamTypeId autoMockThingHttpportParamTypeId = ParamTypeId("{bfeb0613-dab6-408c-aa27-c362c921d0d1}"); ParamTypeId autoMockThingAsyncParamTypeId = ParamTypeId("{a5c4315f-0624-4971-87c1-4bbfbfdbd16e}"); ParamTypeId autoMockThingBrokenParamTypeId = ParamTypeId("{66179395-ef7a-4013-9fc6-2084104eea09}"); +ParamTypeId autoMockSettingsMockSettingParamTypeId = ParamTypeId("{da0b9106-03cf-4631-87e9-26ade3360182}"); StateTypeId autoMockIntStateTypeId = StateTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); StateTypeId autoMockBoolValueStateTypeId = StateTypeId("{978b0ba5-d008-41bd-b63d-a3bd23cb6469}"); EventTypeId autoMockIntEventTypeId = EventTypeId("{74b24296-ba0b-4fbd-87f3-1b09a8bc3e8c}"); @@ -393,6 +394,9 @@ const QString translations[] { //: The name of the ThingClass ({753f0d32-0468-4d08-82ed-1964aab03298}) QT_TRANSLATE_NOOP("mock", "Mock Thing"), + //: The name of the ParamType (ThingClass: autoMock, Type: settings, ID: {da0b9106-03cf-4631-87e9-26ade3360182}) + QT_TRANSLATE_NOOP("mock", "Mock setting"), + //: The name of the ThingClass ({ab4257b3-7548-47ee-9bd4-7dc3004fd197}) QT_TRANSLATE_NOOP("mock", "Mocked Thing (Auto created)"), diff --git a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts similarity index 93% rename from plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts rename to plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts index ecca0304..6f012e57 100644 --- a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de_DE.ts +++ b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts @@ -1,8 +1,12 @@ - + - DevicePluginMock + IntegrationPluginMock + + This mocked thing is intentionally broken. + Dieses Mock ist absichtlich kaputt. + Failed to open HTTP port. Port in use? Fehler beim Öffnen des HTTP Ports. Wird der Port bereits benutzt? @@ -11,6 +15,14 @@ Wait 3 second before you continue, the push button will be pressed automatically. Warte 3 Sekunden bevor du forfährst, der Push Button wird automatisch gedrückt. + + Please enter the secret which normaly will be displayed on the device. For this mocked thing the pin is 243681. + Bitte den geheimen PIN eingeben welcher normalerweise auf dem Gerät angezeigt wird. Für dieses Mock ist die PIN 243681. + + + Please enter login credentials for the mocked thing ("user" and "password"). + Bitte die Login-Daten für dieses Mock eingeben ("user" und "password"). + The push button has not been pressed. Der Push button wirde nicht gedrückt. @@ -27,18 +39,6 @@ This mock action is intentionally broken. Diese Mock-Aktion ist absichtlich kaputt. - - This mocked thing is intentionally broken. - Dieses Mock ist absichtlich kaputt. - - - Please enter the secret which normaly will be displayed on the device. For this mocked thing the pin is 243681. - Bitte den geheimen PIN eingeben welcher normalerweise auf dem Gerät angezeigt wird. Für dieses Mock ist die PIN 243681. - - - Please enter login credentials for the mocked thing ("user" and "password"). - Bitte die Login-Daten für dieses Mock eingeben ("user" und "password"). - This thing will simulate a push button press in 3 seconds. Dieses "Thing" wird einen Push Button in 3 Sekunden simulieren. @@ -349,14 +349,14 @@ The name of the EventType ({863d5920-b1cf-4eb9-88bd-8f7b8583b1cf}) of ThingClass Set Writable UInt (min/max) The name of the ActionType ({79238998-eaab-4d71-b406-5d78f1749751}) of ThingClass inputTypeMock - + Setze schreibbaren UInt (min/max) Set allowed values The name of the ActionType ({b463c5ae-4d55-402f-8480-a5cdb485c143}) of ThingClass displayPinMock ---------- The name of the ActionType ({05f63f9c-f61e-4dcf-ad55-3f13fde2765b}) of ThingClass pushButtonMock - Mögliche Werte setzen + Mögliche Werte setzen Set bool value @@ -367,115 +367,115 @@ The name of the ActionType ({d24ede5f-4064-4898-bb84-cfb533b1fbc0}) of ThingClas The name of the ActionType ({7ffe514f-7999-4998-8350-0e73e222a8c4}) of ThingClass displayPinMock ---------- The name of the ActionType ({e680f7a4-b39e-46da-be41-fa3170fe3768}) of ThingClass pushButtonMock - Setze boolschen Wert + Setze boolschen Wert Set color The name of the ActionType ({3e161294-8a0d-4384-9676-6959e08cc2fa}) of ThingClass displayPinMock ---------- The name of the ActionType ({20dc7c22-c50e-42db-837c-2bbced939f8e}) of ThingClass pushButtonMock - Setze Farbe + Setze Farbe Set double value The name of the ActionType ({17635624-7c19-4bae-8429-2f7aa5d2f843}) of ThingClass displayPinMock ---------- The name of the ActionType ({53cd7c55-49b7-441b-b970-9048f20f0e2c}) of ThingClass pushButtonMock - Setze Gleitkommazahl + Setze Gleitkommazahl Set percentage The name of the ActionType ({527f0687-0b28-4c26-852c-25b8f83e4797}) of ThingClass displayPinMock ---------- The name of the ActionType ({72981c04-267a-4ba0-a59e-9921d2f3af9c}) of ThingClass pushButtonMock - Setze Prozent + Setze Prozent Setting 1 The name of the ParamType (ThingClass: mock, Type: settings, ID: {367f7ba4-5039-47be-abd8-59cc8eaf4b9a}) - + Einstellung 1 String The name of the ParamType (ThingClass: inputTypeMock, EventType: string, ID: {27f69ca9-a321-40ff-bfee-4b0272a671b4}) ---------- The name of the StateType ({27f69ca9-a321-40ff-bfee-4b0272a671b4}) of ThingClass inputTypeMock - + Zeichenkette String changed The name of the EventType ({27f69ca9-a321-40ff-bfee-4b0272a671b4}) of ThingClass inputTypeMock - + Zeichenkette gändert Text area The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {716f0994-bc01-42b0-b64d-59236f7320d2}) - Textfeld + Textfeld Text line The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {e6acf0c7-4b8e-4296-ac62-855d20deb816}) - Textzeile + Textzeile Time The name of the ParamType (ThingClass: inputTypeMock, EventType: time, ID: {8250c71e-59bc-41ab-b576-99fcfc34e8d1}) ---------- The name of the StateType ({8250c71e-59bc-41ab-b576-99fcfc34e8d1}) of ThingClass inputTypeMock - + Zeit Time changed The name of the EventType ({8250c71e-59bc-41ab-b576-99fcfc34e8d1}) of ThingClass inputTypeMock - + Zeit geändert Timeout action The name of the ActionType ({854a0a4a-803f-4b7f-9dce-b07794f9011b}) of ThingClass displayPinMock ---------- The name of the ActionType ({54646e7c-bc54-4895-81a2-590d72d120f9}) of ThingClass pushButtonMock - Timeout Aktion + Timeout Aktion Timestamp (Int) The name of the ParamType (ThingClass: inputTypeMock, EventType: timestampInt, ID: {2c91b5ef-c2d1-4367-bc65-5a13abf69641}) ---------- The name of the StateType ({2c91b5ef-c2d1-4367-bc65-5a13abf69641}) of ThingClass inputTypeMock - + Zeitstempel (Int) Timestamp (Int) changed The name of the EventType ({2c91b5ef-c2d1-4367-bc65-5a13abf69641}) of ThingClass inputTypeMock - + Zeitstempel (Int) geändert Timestamp (UInt) The name of the ParamType (ThingClass: inputTypeMock, EventType: timestampUInt, ID: {6c9a96e8-0d48-4f42-8967-848358fd7f79}) ---------- The name of the StateType ({6c9a96e8-0d48-4f42-8967-848358fd7f79}) of ThingClass inputTypeMock - + Zeitstempel (UInt) Timestamp (UInt) changed The name of the EventType ({6c9a96e8-0d48-4f42-8967-848358fd7f79}) of ThingClass inputTypeMock - + Zeitstempel (UInt) geändert UInt The name of the ParamType (ThingClass: inputTypeMock, EventType: uint, ID: {19e74fcc-bfd5-491f-8eb6-af128e8f1162}) ---------- The name of the StateType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of ThingClass inputTypeMock - + UInt UInt changed The name of the EventType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of ThingClass inputTypeMock - + UInt geändert URL The name of the ParamType (ThingClass: inputTypeMock, Type: thing, ID: {fa67229f-fcef-496f-b671-59a4b48f3ab5}) - URL + URL Writable Bool @@ -484,12 +484,12 @@ The name of the StateType ({19e74fcc-bfd5-491f-8eb6-af128e8f1162}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableBool, ID: {a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) ---------- The name of the StateType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of ThingClass inputTypeMock - Schreibbarer boolscher Wert + Schreibbarer boolscher Wert Writable Bool changed The name of the EventType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of ThingClass inputTypeMock - Schreibbarer Boolscher Wert geändert + Schreibbarer Boolscher Wert geändert Writable Color @@ -498,12 +498,12 @@ The name of the StateType ({a7c11774-f31f-4d64-99d1-e0ae5fb35a5c}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableColor, ID: {455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) ---------- The name of the StateType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of ThingClass inputTypeMock - + Schreibbare Farbe Writable Color changed The name of the EventType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of ThingClass inputTypeMock - + Schreibbare Farbe geändert Writable Double @@ -512,7 +512,7 @@ The name of the StateType ({455f4f68-3cb0-4e8a-a707-62e4a2a8035c}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableDouble, ID: {8e2eb91b-d60b-4461-9a50-d7b8ad263170}) ---------- The name of the StateType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of ThingClass inputTypeMock - + Schreibbare Gleitkommazahl Writable Double (min/max) @@ -521,17 +521,17 @@ The name of the StateType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableDoubleMinMax, ID: {00d3425e-1da6-4748-8906-4555ceefb136}) ---------- The name of the StateType ({00d3425e-1da6-4748-8906-4555ceefb136}) of ThingClass inputTypeMock - + Schreibbare Gleitkommazah (min/max) Writable Double (min/max) changed The name of the EventType ({00d3425e-1da6-4748-8906-4555ceefb136}) of ThingClass inputTypeMock - + Schreibbare Gleitkommazahl (min/max) geändert Writable Double changed The name of the EventType ({8e2eb91b-d60b-4461-9a50-d7b8ad263170}) of ThingClass inputTypeMock - + Schreibbare Gleitkommazahl geändert Writable Int @@ -540,7 +540,7 @@ The name of the StateType ({00d3425e-1da6-4748-8906-4555ceefb136}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableInt, ID: {857a8422-983c-47d6-a15f-d8450b3162f7}) ---------- The name of the StateType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of ThingClass inputTypeMock - Schreibbare Ganzzahl + Schreibbare Ganzzahl Writable Int (min/max) @@ -549,17 +549,17 @@ The name of the StateType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableIntMinMax, ID: {86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) ---------- The name of the StateType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of ThingClass inputTypeMock - Schreibbare Ganzzahl (min/max) + Schreibbare Ganzzahl (min/max) Writable Int (min/max) changed The name of the EventType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of ThingClass inputTypeMock - Schreibbare Ganzzahl (min/max) geändert + Schreibbare Ganzzahl (min/max) geändert Writable Int changed The name of the EventType ({857a8422-983c-47d6-a15f-d8450b3162f7}) of ThingClass inputTypeMock - Schreibbare Ganzzahl geändert + Schreibbare Ganzzahl geändert Writable String @@ -568,7 +568,7 @@ The name of the StateType ({86a107bc-510a-4d38-bfeb-0a9c2b6d8d87}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableString, ID: {ef511043-bd1a-4a5f-984c-222b7da43f38}) ---------- The name of the StateType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of ThingClass inputTypeMock - + Schreibbbare Zeichenkette Writable String (selection) @@ -577,17 +577,17 @@ The name of the StateType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableStringSelection, ID: {209d7afc-6fe9-4fe9-939b-e472ea0ad639}) ---------- The name of the StateType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of ThingClass inputTypeMock - + Schreibbare Zeichenkette (Auswahl) Writable String (selection) changed The name of the EventType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of ThingClass inputTypeMock - + Schreibbare Zeichenkette (Auswahl) geändert Writable String changed The name of the EventType ({ef511043-bd1a-4a5f-984c-222b7da43f38}) of ThingClass inputTypeMock - + Schreibbare Zeichenkette geändert Writable Time @@ -596,12 +596,12 @@ The name of the StateType ({209d7afc-6fe9-4fe9-939b-e472ea0ad639}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableTime, ID: {d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) ---------- The name of the StateType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of ThingClass inputTypeMock - + Schreibbare Zeit Writable Time changed The name of the EventType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of ThingClass inputTypeMock - + Schreibbare Zeit geändert Writable Timestamp (Int) @@ -610,12 +610,12 @@ The name of the StateType ({d64c8b3f-ca7d-47f6-b271-867ffd80a4d4}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableTimestampInt, ID: {88b6746a-b009-4df6-8986-d7884ffd94b2}) ---------- The name of the StateType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of ThingClass inputTypeMock - + Schreibbarer Zeitstempel (Int) Writable Timestamp (Int) changed The name of the EventType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of ThingClass inputTypeMock - + Schreibbarer Zeitstempel (Int) geändert Writable Timestamp (UInt) @@ -624,12 +624,12 @@ The name of the StateType ({88b6746a-b009-4df6-8986-d7884ffd94b2}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableTimestampUInt, ID: {45d0069a-63ac-4265-8170-8152778608ee}) ---------- The name of the StateType ({45d0069a-63ac-4265-8170-8152778608ee}) of ThingClass inputTypeMock - + Schreibbarer Zeitstempel (UInt) Writable Timestamp (UInt) changed The name of the EventType ({45d0069a-63ac-4265-8170-8152778608ee}) of ThingClass inputTypeMock - + Schreibbarer Zeitstempel (UInt) geändert Writable UInt @@ -638,7 +638,7 @@ The name of the StateType ({45d0069a-63ac-4265-8170-8152778608ee}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableUInt, ID: {563e9c4c-5198-400a-9f6c-358f4752af58}) ---------- The name of the StateType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of ThingClass inputTypeMock - + Schreibbarer UInt Writable UInt (min/max) @@ -647,7 +647,7 @@ The name of the StateType ({563e9c4c-5198-400a-9f6c-358f4752af58}) of ThingClass The name of the ParamType (ThingClass: inputTypeMock, EventType: writableUIntMinMax, ID: {79238998-eaab-4d71-b406-5d78f1749751}) ---------- The name of the StateType ({79238998-eaab-4d71-b406-5d78f1749751}) of ThingClass inputTypeMock - + Schriebbarer UInt (min/max) Writable UInt (min/max) changed @@ -893,5 +893,10 @@ The name of the ParamType (ThingClass: mock, Type: discovery, ID: {d222adb4-2f9c The name of the ActionType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of ThingClass mock Ein-/Ausschalten + + Mock setting + The name of the ParamType (ThingClass: autoMock, Type: settings, ID: {da0b9106-03cf-4631-87e9-26ade3360182}) + Mock-Einstellung + diff --git a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts index 95d2191c..b4bc0c2b 100644 --- a/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts +++ b/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts @@ -2,7 +2,11 @@ - DevicePluginMock + IntegrationPluginMock + + This mocked thing is intentionally broken. + + Failed to open HTTP port. Port in use? @@ -11,6 +15,14 @@ Wait 3 second before you continue, the push button will be pressed automatically. + + Please enter the secret which normaly will be displayed on the device. For this mocked thing the pin is 243681. + + + + Please enter login credentials for the mocked thing ("user" and "password"). + + The push button has not been pressed. @@ -27,18 +39,6 @@ This mock action is intentionally broken. - - This mocked thing is intentionally broken. - - - - Please enter the secret which normaly will be displayed on the device. For this mocked thing the pin is 243681. - - - - Please enter login credentials for the mocked thing ("user" and "password"). - - This thing will simulate a push button press in 3 seconds. @@ -893,5 +893,10 @@ The name of the ParamType (ThingClass: mock, Type: discovery, ID: {d222adb4-2f9c The name of the ActionType ({064aed0d-da4c-49d4-b236-60f97e98ff84}) of ThingClass mock + + Mock setting + The name of the ParamType (ThingClass: autoMock, Type: settings, ID: {da0b9106-03cf-4631-87e9-26ade3360182}) + + diff --git a/tests/auto/integrations/testintegrations.cpp b/tests/auto/integrations/testintegrations.cpp index 801b5a9b..9b8375dc 100644 --- a/tests/auto/integrations/testintegrations.cpp +++ b/tests/auto/integrations/testintegrations.cpp @@ -143,6 +143,8 @@ private slots: void asyncSetupEmitsSetupStatusUpdate(); + void testTranslations(); + // Keep those at last as they will remove things void removeThing_data(); void removeThing(); @@ -158,6 +160,7 @@ void TestIntegrations::initTestCase() QLoggingCategory::setFilterRules("*.debug=false\n" "Tests.debug=true\n" "Mock.debug=true\n" + "Translations.debug=true\n" ); // Adding an async mock to be used in tests below @@ -2148,6 +2151,85 @@ void TestIntegrations::asyncSetupEmitsSetupStatusUpdate() QVERIFY2(thingsWithSetupInProgress.isEmpty(), "Some things did not finish the setup!"); } +void TestIntegrations::testTranslations() +{ + // switch language to de_AT + QVariantMap params; + params.insert("locale", "de_AT"); + QVariantMap handShake = injectAndWait("JSONRPC.Hello", params).toMap(); + QCOMPARE(handShake.value("params").toMap().value("locale").toString(), QString("de_AT")); + + QVariantMap thingClasses = injectAndWait("Integrations.GetThingClasses").toMap(); + bool found = false; + foreach (const QVariant &tcVariant, thingClasses.value("params").toMap().value("thingClasses").toList()) { + QVariantMap tcMap = tcVariant.toMap(); + if (tcMap.value("id").toUuid() == autoMockThingClassId) { + found = true; + + // Verify thingClass' displayName is translated + QCOMPARE(tcMap.value("displayName").toString(), QString("Mock \"Thing\" (automatisch erstellt)")); + + // Verify paramTypes are translated + bool ptFound = false; + foreach (const QVariant &ptVariant, tcMap.value("paramTypes").toList()) { + QVariantMap ptMap = ptVariant.toMap(); + if (ptMap.value("id").toUuid() == autoMockThingAsyncParamTypeId) { + ptFound = true; + QCOMPARE(ptMap.value("displayName").toString(), QString("asynchron")); + } + } + QVERIFY2(ptFound, "ParamType not found in mock thing class."); + + + // Verify settings are translated + bool sFound = false; + foreach (const QVariant &sVariant, tcMap.value("settingsTypes").toList()) { + QVariantMap sMap = sVariant.toMap(); + if (sMap.value("id").toUuid() == autoMockSettingsMockSettingParamTypeId) { + sFound = true; + QCOMPARE(sMap.value("displayName").toString(), QString("Mock-Einstellung")); + } + } + QVERIFY2(sFound, "SettingsType not found in mock thing class."); + + // Verify stateTypes are translated + bool stFound = false; + foreach (const QVariant &stVariant, tcMap.value("stateTypes").toList()) { + QVariantMap stMap = stVariant.toMap(); + if (stMap.value("id").toUuid() == autoMockIntStateTypeId) { + stFound = true; + QCOMPARE(stMap.value("displayName").toString(), QString("Simulierter Integer Zustand")); + } + } + QVERIFY2(stFound, "StateType not found in mock thing class."); + + // Verify eventTypes are translated + bool etFound = false; + foreach (const QVariant &etVariant, tcMap.value("eventTypes").toList()) { + QVariantMap etMap = etVariant.toMap(); + if (etMap.value("id").toUuid() == autoMockIntEventTypeId) { + etFound = true; + QCOMPARE(etMap.value("displayName").toString(), QString("Simulierter Integer Zustand geändert")); + } + } + QVERIFY2(etFound, "EventType not found in mock thing class."); + + // Verify actionTypes are translated + bool atFound = false; + foreach (const QVariant &atVariant, tcMap.value("actionTypes").toList()) { + QVariantMap atMap = atVariant.toMap(); + if (atMap.value("id").toUuid() == autoMockWithParamsActionTypeId) { + atFound = true; + QCOMPARE(atMap.value("displayName").toString(), QString("Mock Aktion 1 (mit Parameter)")); + } + } + QVERIFY2(atFound, "ActionType not found in mock thing class."); + } + } + QVERIFY2(found, "Mock thing class not found."); + +} + #include "testintegrations.moc" QTEST_MAIN(TestIntegrations) diff --git a/translations/nymead-cs.ts b/translations/nymead-cs.ts index 5d673066..ba0171a1 100644 --- a/translations/nymead-cs.ts +++ b/translations/nymead-cs.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-da.ts b/translations/nymead-da.ts index edd81668..f189aea6 100644 --- a/translations/nymead-da.ts +++ b/translations/nymead-da.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-de_DE.ts b/translations/nymead-de.ts similarity index 98% rename from translations/nymead-de_DE.ts rename to translations/nymead-de.ts index 459fd370..9500ed60 100644 --- a/translations/nymead-de_DE.ts +++ b/translations/nymead-de.ts @@ -1,6 +1,6 @@ - + CloudNotifications @@ -49,9 +49,9 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. - + Das Plugin für dieses \"Thing\" konnte nicht geladen werden. @@ -100,7 +100,7 @@ Categories are: Log output is colorized by default. Use this option to disable colors. - + Die Log-Ausgabe ist normalerweise eingefärbt. Diese Option ermöglicht das Ausschalten der Farbe. @@ -127,7 +127,7 @@ Categories are: Information The name of the section tab in the debug server interface - + Imformationen @@ -136,7 +136,7 @@ Categories are: The name of the section tab in the debug server interface ---------- The network section of the debug interface - + Netzwerk @@ -273,7 +273,7 @@ The network section of the debug interface Generate report In the server information section of the debug interface - + Bericht generieren diff --git a/translations/nymead-en_US.ts b/translations/nymead-en_US.ts index 73545a0c..60aa9568 100644 --- a/translations/nymead-en_US.ts +++ b/translations/nymead-en_US.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-es.ts b/translations/nymead-es.ts index 7fac08b2..35c6a361 100644 --- a/translations/nymead-es.ts +++ b/translations/nymead-es.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-fi.ts b/translations/nymead-fi.ts index dac4bf2a..d92704d2 100644 --- a/translations/nymead-fi.ts +++ b/translations/nymead-fi.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-fr.ts b/translations/nymead-fr.ts index 6806b8c5..a5399669 100644 --- a/translations/nymead-fr.ts +++ b/translations/nymead-fr.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-it.ts b/translations/nymead-it.ts index b752c0f1..4db7b9d4 100644 --- a/translations/nymead-it.ts +++ b/translations/nymead-it.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-nl.ts b/translations/nymead-nl.ts index aebc8137..cd786320 100644 --- a/translations/nymead-nl.ts +++ b/translations/nymead-nl.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded. diff --git a/translations/nymead-pt.ts b/translations/nymead-pt.ts index 385b71fd..0431b61c 100644 --- a/translations/nymead-pt.ts +++ b/translations/nymead-pt.ts @@ -49,7 +49,7 @@ ThingManagerImplementation - + The plugin for this thing is not loaded.