From aa57be0c50fa4892825f96ce909b3369d4447b49 Mon Sep 17 00:00:00 2001 From: Tobias Preuss Date: Thu, 11 Nov 2021 20:37:40 +0100 Subject: [PATCH] Facilitate translation of "device status" screen. + Extract English texts into constants. + Add German translations. --- airrohr-firmware/airrohr-firmware.ino | 14 +++++++------- airrohr-firmware/intl_de.h | 9 +++++++++ airrohr-firmware/intl_en.h | 9 +++++++++ 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/airrohr-firmware/airrohr-firmware.ino b/airrohr-firmware/airrohr-firmware.ino index 2c5b3c2a..89ed4904 100644 --- a/airrohr-firmware/airrohr-firmware.ino +++ b/airrohr-firmware/airrohr-firmware.ino @@ -1625,12 +1625,12 @@ static void webserver_status() { #endif versionHtml.replace("/", FPSTR(BR_TAG)); add_table_row_from_value(page_content, FPSTR(INTL_FIRMWARE), versionHtml); - add_table_row_from_value(page_content, F("Free Memory"), String(ESP.getFreeHeap())); + add_table_row_from_value(page_content, F(INTL_FREE_MEMORY), String(ESP.getFreeHeap())); #if defined(ESP8266) - add_table_row_from_value(page_content, F("Heap Fragmentation"), String(ESP.getHeapFragmentation()), "%"); + add_table_row_from_value(page_content, F(INTL_HEAP_FRAGMENTATION), String(ESP.getHeapFragmentation()), "%"); #endif if (cfg::auto_update) { - add_table_row_from_value(page_content, F("Last OTA"), delayToString(millis() - last_update_attempt)); + add_table_row_from_value(page_content, F(INTL_LAST_OTA), delayToString(millis() - last_update_attempt)); } #if defined(ESP8266) add_table_row_from_value(page_content, F("NTP Sync"), String(sntp_time_set)); @@ -1644,7 +1644,7 @@ static void webserver_status() { ntpinfo.print(FPSTR(BR_TAG)); } ntpinfo.printf_P(PSTR("%s (%s)"), IPAddress(*sntp).toString().c_str(), name ? name : "?"); - ntpinfo.printf_P(PSTR(" reachable: %s"), sntp_getreachability(i) ? "Yes" : "No"); + ntpinfo.printf_P(PSTR(" %s: %s"), F(INTL_REACHABLE), sntp_getreachability(i) ? F(INTL_YES) : F(INTL_NO)); } } add_table_row_from_value(page_content, F("NTP Info"), ntpinfo); @@ -1652,9 +1652,9 @@ static void webserver_status() { time_t now = time(nullptr); add_table_row_from_value(page_content, FPSTR(INTL_TIME_UTC), ctime(&now)); - add_table_row_from_value(page_content, F("Uptime"), delayToString(millis() - time_point_device_start_ms)); + add_table_row_from_value(page_content, F(INTL_UPTIME), delayToString(millis() - time_point_device_start_ms)); #if defined(ESP8266) - add_table_row_from_value(page_content, F("Reset Reason"), ESP.getResetReason()); + add_table_row_from_value(page_content, F(INTL_RESET_REASON), ESP.getResetReason()); #endif if (cfg::sds_read) { page_content += FPSTR(EMPTY_ROW); @@ -1696,7 +1696,7 @@ static void webserver_status() { } if (last_sendData_returncode != 0) { - add_table_row_from_value(page_content, F("Data Send Return"), + add_table_row_from_value(page_content, F(INTL_DATA_SEND_RETURN_CODE), last_sendData_returncode > 0 ? String(last_sendData_returncode) : HTTPClient::errorToString(last_sendData_returncode)); } if (cfg::sds_read) { diff --git a/airrohr-firmware/intl_de.h b/airrohr-firmware/intl_de.h index 52860420..d8b663f2 100644 --- a/airrohr-firmware/intl_de.h +++ b/airrohr-firmware/intl_de.h @@ -125,5 +125,14 @@ const char INTL_SIGNAL_QUALITY[] PROGMEM = "Qualität"; #define INTL_SENSOR "Sensor" #define INTL_PARAMETER "Parameter" #define INTL_VALUE "Wert" +#define INTL_DATA_SEND_RETURN_CODE "Daten senden Return Code" +#define INTL_UPTIME "Aktiv seit" +#define INTL_RESET_REASON "Grund des Zurücksetzens" +#define INTL_HEAP_FRAGMENTATION "Heap Fragmentierung" +#define INTL_FREE_MEMORY "Freier Speicher" +#define INTL_REACHABLE "erreichbar" +#define INTL_YES "Ja" +#define INTL_NO "Nein" +#define INTL_LAST_OTA "Letzter OTA" #include "./airrohr-logo-common.h" diff --git a/airrohr-firmware/intl_en.h b/airrohr-firmware/intl_en.h index 90899e9b..bd98ed6e 100644 --- a/airrohr-firmware/intl_en.h +++ b/airrohr-firmware/intl_en.h @@ -125,5 +125,14 @@ const char INTL_SIGNAL_QUALITY[] PROGMEM = "signal quality"; #define INTL_SENSOR "Sensor" #define INTL_PARAMETER "Parameter" #define INTL_VALUE "Value" +#define INTL_DATA_SEND_RETURN_CODE "Data Send Return" +#define INTL_UPTIME "Uptime" +#define INTL_RESET_REASON "Reset Reason" +#define INTL_HEAP_FRAGMENTATION "Heap Fragmentation" +#define INTL_FREE_MEMORY "Free Memory" +#define INTL_REACHABLE "reachable" +#define INTL_YES "Yes" +#define INTL_NO "No" +#define INTL_LAST_OTA "Last OTA" #include "./airrohr-logo-common.h"