From 85b48fe214b2c979b3e5bf7dfc167a3dbce460ca Mon Sep 17 00:00:00 2001 From: Moepchi Date: Thu, 30 Jul 2026 16:58:30 +0200 Subject: [PATCH] Add German/English UI localization with language switcher Introduces an i18n layer (src/i18n.tsx) with auto-detection (defaulting to English) and a persisted override, wires every user-facing string in App.tsx through it, and adds a language selector to the Anwendung options panel in the same spot the native TeamSpeak client uses. --- web/src/App.tsx | 402 +++++++++++++++++++++++------------------- web/src/i18n.tsx | 447 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 668 insertions(+), 181 deletions(-) create mode 100644 web/src/i18n.tsx diff --git a/web/src/App.tsx b/web/src/App.tsx index 1adb304..f0031e3 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -9,6 +9,7 @@ import { listAudioOutputDevices, pickAudioOutputDevice, } from "./voice"; +import { LanguageProvider, useLanguage, useT, type LangPref } from "./i18n"; // In dev, the gateway runs standalone on its own port. In production it's // served from the same origin/port as the web app (single container behind a @@ -132,12 +133,13 @@ function ClientIcon() { } function ClientStatusIcons({ client }: { client: ClientInfo }) { + const t = useT(); return ( - {client.isChannelCommander && ⭐} - {client.away && 💤} - {(client.inputMuted || !client.inputHardwareEnabled) && 🔇} - {client.outputMuted && 🔕} + {client.isChannelCommander && ⭐} + {client.away && 💤} + {(client.inputMuted || !client.inputHardwareEnabled) && 🔇} + {client.outputMuted && 🔕} ); } @@ -176,6 +178,7 @@ function ChannelTree({ onOpenPrivateChat: (clientId: number, clientName: string) => void; onPokeClient: (clientId: number, clientName: string) => void; }) { + const t = useT(); const children = channels.filter((c) => c.parent === parent).sort((a, b) => a.order - b.order); if (children.length === 0) return null; @@ -189,11 +192,11 @@ function ChannelTree({ }`} onClick={() => onSelectItem({ type: "channel", id: channel.id })} onDoubleClick={() => onSwitchChannel(channel.id)} - title="Click to select, double-click to join" + title={t("tree.clickToSelect")} > {channel.name} - {channel.hasPassword && 🔒} + {channel.hasPassword && 🔒}