Skip to content

Commit

Permalink
Facilitate translation of "device status" screen.
Browse files Browse the repository at this point in the history
+ Extract English texts into constants.
+ Add German translations.
  • Loading branch information
johnjohndoe committed Nov 11, 2021
1 parent a7710e7 commit aa57be0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 7 additions & 7 deletions airrohr-firmware/airrohr-firmware.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -1644,17 +1644,17 @@ 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);
#endif

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);
Expand Down Expand Up @@ -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) {
Expand Down
9 changes: 9 additions & 0 deletions airrohr-firmware/intl_de.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
9 changes: 9 additions & 0 deletions airrohr-firmware/intl_en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit aa57be0

Please sign in to comment.