diff options
author | 2017-12-29 23:08:42 +0100 | |
---|---|---|
committer | 2017-12-29 23:08:42 +0100 | |
commit | 185ae074eacfd75a597515f7f9de1b51c4e0336b (patch) | |
tree | 89a8f439923f3eac4721f66f7a0af2d6b9dca707 | |
parent | 133b60335c1849152a881a352dee05dd098fa058 (diff) |
update translation on language changedsandbox/ctxnop/multilang
Change-Id: I12130b4a1c5c6dad9658972d32b4b9e362a8d1cc
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
-rw-r--r-- | app/HVAC.qml | 1 | ||||
-rw-r--r-- | app/api/Binding.qml | 8 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/HVAC.qml b/app/HVAC.qml index 7710589..7f1479b 100644 --- a/app/HVAC.qml +++ b/app/HVAC.qml @@ -33,6 +33,7 @@ ApplicationWindow { id: binding url: bindingAddress onFanSpeedChanged: fanSpeedSlider.value = fanSpeed + onLanguageChanged: translator.language = language } ColumnLayout { diff --git a/app/api/Binding.qml b/app/api/Binding.qml index 673cfdd..25388df 100644 --- a/app/api/Binding.qml +++ b/app/api/Binding.qml @@ -27,6 +27,7 @@ WebSocket { property real fanSpeed: 0.0 property real leftTemperature: 21.0 property real rightTemperature: 21.0 + property string language: "en_US" property Connections c : Connections { target: root @@ -45,6 +46,11 @@ WebSocket { console.debug(JSON.stringify(json)) sendTextMessage(JSON.stringify(json)) } + onLanguageChanged: { + var json = [MessageId.call, '9999', 'hvac/set', {'Language': language}] + console.debug(JSON.stringify(json)) + sendTextMessage(JSON.stringify(json)) + } } onTextMessageReceived: { @@ -64,7 +70,7 @@ WebSocket { case MessageId.event: if (json[1] == "hvac/language") console.log("HVAC event received: ",json[2]) - ApplicationWindow.root.translator.language = json[2].data + root.language = json[2].data root.statusString = "Language changed to "+language break } |