From e47fc066b0608132c44a35f7041be80b263adcff Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Wed, 8 May 2024 23:38:56 +0200 Subject: [PATCH] Add German translation, add own price source selection --- src/lib/i18n/index.ts | 1 + src/lib/locales/de.json | 88 ++++++++++++++++++++++++++++++++++++++ src/lib/locales/en.json | 9 +++- src/lib/locales/es.json | 9 +++- src/lib/locales/nl.json | 9 +++- src/routes/+layout.svelte | 3 +- src/routes/+page.svelte | 2 +- src/routes/Control.svelte | 16 +++++++ src/routes/Settings.svelte | 38 ++++++++++++++++ 9 files changed, 167 insertions(+), 8 deletions(-) create mode 100644 src/lib/locales/de.json diff --git a/src/lib/i18n/index.ts b/src/lib/i18n/index.ts index 42c6812..2959787 100644 --- a/src/lib/i18n/index.ts +++ b/src/lib/i18n/index.ts @@ -6,6 +6,7 @@ const defaultLocale = 'en'; register('en', () => import('../locales/en.json')); register('nl', () => import('../locales/nl.json')); register('es', () => import('../locales/es.json')); +register('de', () => import('../locales/de.json')); init({ fallbackLocale: defaultLocale, diff --git a/src/lib/locales/de.json b/src/lib/locales/de.json new file mode 100644 index 0000000..0145246 --- /dev/null +++ b/src/lib/locales/de.json @@ -0,0 +1,88 @@ +{ + "section": { + "settings": { + "title": "Einstellungen", + "textColor": "Textfarbe", + "backgroundColor": "Hintergrundfarbe", + "ledPowerOnTest": "LED-Einschalttest", + "ledFlashOnBlock": "LED blinkt bei neuem Block", + "timePerScreen": "Zeit pro Bildschirm", + "ledBrightness": "LED-Helligkeit", + "flMaxBrightness": "Displaybeleuchtung Helligkeit", + "timezoneOffset": "Zeitzonenoffset", + "timeBetweenPriceUpdates": "Zeit zwischen Preisaktualisierungen", + "fullRefreshEvery": "Vollständige Aktualisierung alle", + "mempoolnstance": "Mempool Instance", + "hostnamePrefix": "Hostnamen-Präfix", + "StealFocusOnNewBlock": "Steal focus on new block", + "useBigCharsMcap": "Verwende große Zeichen für die Marktkapitalisierung", + "useBlkCountdown": "Blocks Countdown zur Halbierung", + "useSatsSymbol": "Sats-Symbol verwenden", + "suffixPrice": "Suffix-Preisformat", + "disableLeds": "Alle LED-Effekte deaktivieren", + "otaUpdates": "OTA updates", + "enableMdns": "mDNS", + "fetchEuroPrice": "€-Preis abrufen", + "shortAmountsWarning": "Geringe Beträge können die Lebensdauer der Displays verkürzen", + "tzOffsetHelpText": "Ein Neustart ist erforderlich, um den TZ-Offset anzuwenden.", + "screens": "Bildschirme", + "wifiTxPowerText": "In den meisten Fällen muss dies nicht eingestellt werden.", + "wifiTxPower": "WiFi-TX-Leistung", + "settingsSaved": "Einstellungen gespeichert", + "errorSavingSettings": "Fehler beim Speichern der Einstellungen", + "ownPriceSource": "BTClock-Preisquelle verwenden", + "flAlwaysOn": "Displaybeleuchtung immer an" + }, + "control": { + "systemInfo": "Systeminfo", + "version": "Version", + "buildTime": "Build time", + "ledColor": "LED-Farbe", + "turnOff": "Ausschalten", + "setColor": "Farbe festlegen", + "showText": "Text anzeigen", + "text": "Text", + "title": "Kontrolle", + "hostname": "Hostname", + "frontlight": "Displaybeleuchtung", + "turnOn": "Einschalten" + }, + "status": { + "title": "Status", + "screenCycle": "Bildschirmzyklus", + "memoryFree": "Speicher frei", + "wsPriceConnection": "WS-Preisverbindung", + "wsMempoolConnection": "WS Mempool.space-Verbindung", + "fetchEuroNote": "If you use \"Fetch € price\" the WS Price connection will show ❌ since it uses another data source.", + "uptime": "Betriebszeit", + "wifiSignalStrength": "WiFi-Signalstärke" + } + }, + "colors": { + "black": "Schwarz", + "white": "Weiss" + }, + "time": { + "minutes": "Minuten", + "seconds": "Sekunden" + }, + "restartRequired": "Neustart erforderlich", + "button": { + "save": "Speichern", + "reset": "Zurücksetzen", + "restart": "Neustart", + "forceFullRefresh": "Vollständige Aktualisierung erzwingen" + }, + "timer": { + "running": "läuft", + "stopped": "gestoppt" + }, + "sections": { + "control": { + "keepSameColor": "Gleiche Farbe beibehalten" + } + }, + "rssiBar": { + "tooltip": "Werte > -67 dBm gelten als gut. > -30 dBm ist erstaunlich" + } +} diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json index aab360c..3f634ad 100644 --- a/src/lib/locales/en.json +++ b/src/lib/locales/en.json @@ -28,7 +28,10 @@ "wifiTxPowerText": "In most cases this does not need to be set.", "wifiTxPower": "WiFi TX power", "settingsSaved": "Settings saved", - "errorSavingSettings": "Error saving settings" + "errorSavingSettings": "Error saving settings", + "ownPriceSource": "Use BTClock price source", + "flMaxBrightness": "Frontlight brightness", + "flAlwaysOn": "Frontlight always on" }, "control": { "systemInfo": "System info", @@ -40,7 +43,9 @@ "showText": "Show text", "text": "Text", "title": "Control", - "hostname": "Hostname" + "hostname": "Hostname", + "frontlight": "Frontlight", + "turnOn": "Turn on" }, "status": { "title": "Status", diff --git a/src/lib/locales/es.json b/src/lib/locales/es.json index adc42ab..e9b50c4 100644 --- a/src/lib/locales/es.json +++ b/src/lib/locales/es.json @@ -27,7 +27,10 @@ "otaUpdates": "Actualización por aire", "wifiTxPowerText": "En la mayoría de los casos no es necesario configurar esto.", "settingsSaved": "Configuración guardada", - "errorSavingSettings": "Error al guardar la configuración" + "errorSavingSettings": "Error al guardar la configuración", + "ownPriceSource": "Usar fuente de precios BTClock", + "flMaxBrightness": "Brillo de luz de la pantalla", + "flAlwaysOn": "Luz de la pantalla siempre encendida" }, "control": { "turnOff": "Apagar", @@ -39,7 +42,9 @@ "text": "Texto", "title": "Control", "buildTime": "Tiempo de compilación", - "hostname": "Nombre del host" + "hostname": "Nombre del host", + "turnOn": "Encender", + "frontlight": "Luz de la pantalla" }, "status": { "memoryFree": "Memoria RAM libre", diff --git a/src/lib/locales/nl.json b/src/lib/locales/nl.json index 90d47c2..1c82e93 100644 --- a/src/lib/locales/nl.json +++ b/src/lib/locales/nl.json @@ -28,7 +28,10 @@ "wifiTxPower": "WiFi TX power", "wifiTxPowerText": "Meestal hoeft dit niet aangepast te worden.", "settingsSaved": "Instellingen opgeslagen", - "errorSavingSettings": "Fout bij opslaan instellingen" + "errorSavingSettings": "Fout bij opslaan instellingen", + "ownPriceSource": "Gebruik BTClock prijs bron", + "flMaxBrightness": "Displaylicht helderheid", + "flAlwaysOn": "Displaylicht altijd aan" }, "control": { "systemInfo": "Systeeminformatie", @@ -39,7 +42,9 @@ "ledColor": "LED kleur", "showText": "Toon tekst", "text": "Tekst", - "title": "Besturing" + "title": "Besturing", + "frontlight": "Displaylicht", + "turnOn": "Aanzetten" }, "status": { "title": "Status", diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 7f4684d..98c83de 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -24,7 +24,8 @@ const flagMap: { [key: string]: string } = { en: '🇬🇧', // English flag emoji nl: '🇳🇱', // Dutch flag emoji - es: '🇪🇸' // Spanish flag emoji + es: '🇪🇸', // Spanish flag emoji + de: '🇩🇪' // German flag emoji }; // Convert the language code to lowercase for case-insensitive matching diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 4bc81ca..307c19c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -75,7 +75,7 @@ - ₿TClock + BTClock diff --git a/src/routes/Control.svelte b/src/routes/Control.svelte index 01c41a0..84d0cd6 100644 --- a/src/routes/Control.svelte +++ b/src/routes/Control.svelte @@ -55,6 +55,14 @@ fetch(`${PUBLIC_BASE_URL}/api/lights/off`).catch(() => {}); }; + const turnOnFrontlight = () => { + fetch(`${PUBLIC_BASE_URL}/api/frontlight/on`).catch(() => {}); + }; + + const turnOffFrontlight = () => { + fetch(`${PUBLIC_BASE_URL}/api/frontlight/off`).catch(() => {}); + }; + const restartClock = () => { fetch(`${PUBLIC_BASE_URL}/api/restart`).catch(() => {}); }; @@ -146,6 +154,14 @@
{/if} + {#if $settings.hasFrontlight} +

{$_('section.control.frontlight')}

+ + +
+ {/if}

{$_('section.control.systemInfo')}