From 50eb43b9528226cd6f0d3b81ea1665291fde4305 Mon Sep 17 00:00:00 2001 From: Adrian <35405447+ascillato@users.noreply.github.com> Date: Sun, 1 Apr 2018 12:44:44 -0300 Subject: [PATCH] Make webpage translatable Make webpage translatable #38 --- esp-knx-ip-webserver.cpp | 45 +++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/esp-knx-ip-webserver.cpp b/esp-knx-ip-webserver.cpp index af981b7..23c1649 100644 --- a/esp-knx-ip-webserver.cpp +++ b/esp-knx-ip-webserver.cpp @@ -13,6 +13,9 @@ void ESPKNXIP::__handle_root() m += F(""); m += F(""); #endif + m += F(""); + m += config_webUI.WebPageTitle; + m += F(""); m += F("
"); m += F("

ESP KNX

"); @@ -49,11 +52,22 @@ void ESPKNXIP::__handle_root() m += (*(bool *)feedbacks[i].data) ? F("True") : F("False"); m += F(""); break; - case FEEDBACK_TYPE_ACTION: + case FEEDBACK_TYPE_ACTION: m += F("
"); - break; + m += F("' />"); + if (feedbacks[i].name.length()) // if there is no text, feedback_action is going to be just a button + { + m += F("
"); + } + m += F(""); + if (feedbacks[i].name.length()) + { + m += F("
"); + } + break; } m += F("
"); m += F(""); @@ -86,7 +100,9 @@ void ESPKNXIP::__handle_root() m += F(""); m += F("
"); + m += F("' />
"); m += F(""); m += F(""); } @@ -116,7 +132,9 @@ void ESPKNXIP::__handle_root() m += F(""); } m += F(""); - m += F("
"); + m += F("
"); m += F(""); m += F(""); } @@ -126,7 +144,9 @@ void ESPKNXIP::__handle_root() // Physical address m += F("
"); m += F("
"); - m += F("
Physical address
"); + m += F("
"); + m += config_webUI.PhysAddrLabel; + m += F("
"); m += F(""); @@ -138,7 +158,9 @@ void ESPKNXIP::__handle_root() m += F(""); - m += F("
"); + m += F("
"); m += F("
"); m += F("
"); @@ -220,7 +242,9 @@ void ESPKNXIP::__handle_root() m += F(""); - m += F("
"); + m += F("
"); m += F(""); m += F(""); } @@ -269,6 +293,11 @@ void ESPKNXIP::__handle_root() server->send(200, F("text/html"), m); } +void ESPKNXIP::config_web_UI(config_webUI_t custom_config_webUI) +{ + config_webUI = custom_config_webUI; +} + void ESPKNXIP::__handle_register() { DEBUG_PRINTLN(F("Register called"));