From 6233ad12aeaef6a026725a8bdf51a1a8ca24c734 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sun, 14 Jan 2024 17:29:44 +0100 Subject: [PATCH 01/11] webapp: Prefix Country with CMT2300A --- webapp/src/locales/de.json | 2 +- webapp/src/locales/en.json | 2 +- webapp/src/locales/fr.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/src/locales/de.json b/webapp/src/locales/de.json index c7a707365..af36fdcaa 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -360,7 +360,7 @@ "CmtPaLevel": "CMT2300A Sendeleistung:", "NrfPaLevelHint": "Verwendet für HM-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.", "CmtPaLevelHint": "Verwendet für HMS/HMT-Wechselrichter. Stellen Sie sicher, dass Ihre Stromversorgung stabil genug ist, bevor Sie die Sendeleistung erhöhen.", - "CmtCountry": "Region/Land:", + "CmtCountry": "CMT2300A Region/Land:", "CmtCountryHint": "Jedes Land hat unterschiedliche Frequenzzuteilungen.", "country_0": "Europa ({min}MHz - {max}MHz)", "country_1": "Nordamerika ({min}MHz - {max}MHz)", diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index 0f5618e5c..007b9d0b9 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -360,7 +360,7 @@ "CmtPaLevel": "CMT2300A Transmitting power:", "NrfPaLevelHint": "Used for HM-Inverters. Make sure your power supply is stable enough before increasing the transmit power.", "CmtPaLevelHint": "Used for HMS/HMT-Inverters. Make sure your power supply is stable enough before increasing the transmit power.", - "CmtCountry": "Region/Country:", + "CmtCountry": "CMT2300A Region/Country:", "CmtCountryHint": "Each country has different frequency allocations.", "country_0": "Europe ({min}MHz - {max}MHz)", "country_1": "North America ({min}MHz - {max}MHz)", diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index cd968c5d2..9a2e6a930 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -360,7 +360,7 @@ "CmtPaLevel": "CMT2300A Niveau de puissance d'émission", "NrfPaLevelHint": "Used for HM-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.", "CmtPaLevelHint": "Used for HMS/HMT-Inverters. Assurez-vous que votre alimentation est suffisamment stable avant d'augmenter la puissance d'émission.", - "CmtCountry": "Region/Country:", + "CmtCountry": "CMT2300A Region/Country:", "CmtCountryHint": "Each country has different frequency allocations.", "country_0": "Europe ({min}MHz - {max}MHz)", "country_1": "North America ({min}MHz - {max}MHz)", From f26e82424781da8d78f08545170b84b2f8891b69 Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Mon, 15 Jan 2024 22:40:23 +0100 Subject: [PATCH 02/11] fix #1649 one of the goals of my pull request, besides simplifying the code was to have localization. It's nice that the browser can handle this, but for consistency, we'll go with vue-i18n since it is already available --- webapp/src/components/EventLog.vue | 2 +- webapp/src/components/FirmwareInfo.vue | 5 +++-- webapp/src/locales/de.json | 3 ++- webapp/src/locales/en.json | 3 ++- webapp/src/locales/fr.json | 5 +++-- webapp/src/utils/time.ts | 10 +++++----- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/webapp/src/components/EventLog.vue b/webapp/src/components/EventLog.vue index db2b58382..93877536a 100644 --- a/webapp/src/components/EventLog.vue +++ b/webapp/src/components/EventLog.vue @@ -31,7 +31,7 @@ export default defineComponent({ computed: { timeInHours() { return (value: number) => { - return timestampToString(value); + return timestampToString(this.$i18n.locale, value)[0]; }; }, }, diff --git a/webapp/src/components/FirmwareInfo.vue b/webapp/src/components/FirmwareInfo.vue index 6dd69a14c..5687c1045 100644 --- a/webapp/src/components/FirmwareInfo.vue +++ b/webapp/src/components/FirmwareInfo.vue @@ -49,7 +49,7 @@ {{ $t('firmwareinfo.Uptime') }} - {{ timeInHours(systemStatus.uptime) }} + {{ $t('firmwareinfo.UptimeValue', timeInHours(systemStatus.uptime)) }} @@ -73,7 +73,8 @@ export default defineComponent({ computed: { timeInHours() { return (value: number) => { - return timestampToString(value, true); + const [count, time] = timestampToString(this.$i18n.locale, value, true); + return {count, time}; }; }, versionInfoUrl(): string { diff --git a/webapp/src/locales/de.json b/webapp/src/locales/de.json index af36fdcaa..9afd00140 100644 --- a/webapp/src/locales/de.json +++ b/webapp/src/locales/de.json @@ -188,7 +188,8 @@ "ResetReason0": "Reset Grund CPU 0", "ResetReason1": "Reset Grund CPU 1", "ConfigSaveCount": "Anzahl der Konfigurationsspeicherungen", - "Uptime": "Betriebszeit" + "Uptime": "Betriebszeit", + "UptimeValue": "0 Tage {time} | 1 Tag {time} | {count} Tage {time}" }, "hardwareinfo": { "HardwareInformation": "Hardwareinformationen", diff --git a/webapp/src/locales/en.json b/webapp/src/locales/en.json index 007b9d0b9..e23111610 100644 --- a/webapp/src/locales/en.json +++ b/webapp/src/locales/en.json @@ -188,7 +188,8 @@ "ResetReason0": "Reset Reason CPU 0", "ResetReason1": "Reset Reason CPU 1", "ConfigSaveCount": "Config save count", - "Uptime": "Uptime" + "Uptime": "Uptime", + "UptimeValue": "0 days {time} | 1 day {time} | {count} days {time}" }, "hardwareinfo": { "HardwareInformation": "Hardware Information", diff --git a/webapp/src/locales/fr.json b/webapp/src/locales/fr.json index 9a2e6a930..c7087c450 100644 --- a/webapp/src/locales/fr.json +++ b/webapp/src/locales/fr.json @@ -188,7 +188,8 @@ "ResetReason0": "Raison de la réinitialisation CPU 0", "ResetReason1": "Raison de la réinitialisation CPU 1", "ConfigSaveCount": "Nombre d'enregistrements de la configuration", - "Uptime": "Temps de fonctionnement" + "Uptime": "Durée de fonctionnement", + "UptimeValue": "0 jour {time} | 1 jour {time} | {count} jours {time}" }, "hardwareinfo": { "HardwareInformation": "Informations sur le matériel", @@ -616,4 +617,4 @@ "ValueSelected": "Sélectionné", "ValueActive": "Activé" } -} +} \ No newline at end of file diff --git a/webapp/src/utils/time.ts b/webapp/src/utils/time.ts index 6e0224038..afdb1fff9 100644 --- a/webapp/src/utils/time.ts +++ b/webapp/src/utils/time.ts @@ -1,8 +1,8 @@ -export const timestampToString = (timestampSeconds: number, includeDays = false): string => { - const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString([], { timeZone: "UTC" }); - if (!includeDays) return timeString; +export const timestampToString = (locale: string, timestampSeconds: number, includeDays = false): string[] => { + const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString(locale, { timeZone: "UTC", hour12: false }); + if (!includeDays) return [timeString]; const secondsPerDay = 60 * 60 * 24; - const days = Math.floor(timestampSeconds / secondsPerDay); - return new Intl.RelativeTimeFormat().format(-days, "day") + " " + timeString; + const days = Math.floor(timestampSeconds / secondsPerDay).toFixed(0); + return [days, timeString]; } \ No newline at end of file From caaa7b6347311aefeafa7f59f834ad1a957b80e3 Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Mon, 15 Jan 2024 22:54:04 +0100 Subject: [PATCH 03/11] fix count being a string --- webapp/src/utils/time.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webapp/src/utils/time.ts b/webapp/src/utils/time.ts index afdb1fff9..45f7f3baa 100644 --- a/webapp/src/utils/time.ts +++ b/webapp/src/utils/time.ts @@ -1,8 +1,10 @@ -export const timestampToString = (locale: string, timestampSeconds: number, includeDays = false): string[] => { +export function timestampToString(locale: string, timestampSeconds: number, includeDays: true): [number, string]; +export function timestampToString(locale: string, timestampSeconds: number, includeDays?: false): [string]; +export function timestampToString(locale: string, timestampSeconds: number, includeDays = false): [number, string] | [string] { const timeString = new Date(timestampSeconds * 1000).toLocaleTimeString(locale, { timeZone: "UTC", hour12: false }); if (!includeDays) return [timeString]; const secondsPerDay = 60 * 60 * 24; - const days = Math.floor(timestampSeconds / secondsPerDay).toFixed(0); + const days = Math.floor(timestampSeconds / secondsPerDay); return [days, timeString]; } \ No newline at end of file From 72a2c58f1ee7f183676de28eb589494e595f546b Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Wed, 17 Jan 2024 22:52:22 +0100 Subject: [PATCH 04/11] Update bblanchon/ArduinoJson from 6.21.4 to 6.21.5 --- platformio.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio.ini b/platformio.ini index 54f39481a..ad8169a73 100644 --- a/platformio.ini +++ b/platformio.ini @@ -37,7 +37,7 @@ build_unflags = lib_deps = https://github.com/yubox-node-org/ESPAsyncWebServer - bblanchon/ArduinoJson @ ^6.21.4 + bblanchon/ArduinoJson @ ^6.21.5 https://github.com/bertmelis/espMqttClient.git#v1.5.0 nrf24/RF24 @ ^1.4.8 olikraus/U8g2 @ ^2.35.9 From bfeb852e230697f6fcdb542528c22ca15e98bd0b Mon Sep 17 00:00:00 2001 From: Nikolaj Kappler Date: Tue, 16 Jan 2024 21:08:22 +0100 Subject: [PATCH 05/11] webapp: Remove redundant main container --- webapp/src/App.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/webapp/src/App.vue b/webapp/src/App.vue index 8ace89a17..6fa6eeaa5 100644 --- a/webapp/src/App.vue +++ b/webapp/src/App.vue @@ -1,8 +1,6 @@