Skip to content

Commit 3db7a73

Browse files
committed
ui: switch language toggle to single button
1 parent f70cf07 commit 3db7a73

5 files changed

Lines changed: 24 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
66

77
- Pending
88

9+
## [2.1.10] - 2026-02-10
10+
11+
### Changed
12+
13+
- Language switch is now a single DE/EN toggle button in the top-right corner.
14+
915
## [2.1.9] - 2026-02-10
1016

1117
### Added

app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1725,7 +1725,7 @@ def compile_runner_cfg(state: AppState, runner_id: str, broker: EventBroker) ->
17251725
notifier = NotificationWorker(broker, store)
17261726
rm = RunnerManager(broker, notifier)
17271727

1728-
app = FastAPI(title="command-runner", version="2.1.9")
1728+
app = FastAPI(title="command-runner", version="2.1.10")
17291729
templates = Jinja2Templates(directory=str(BASE_DIR / "templates"))
17301730
app.mount("/static", StaticFiles(directory=str(BASE_DIR / "static")), name="static")
17311731

static/app.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ const I18N = {
8282
no_changes: "Keine Änderungen",
8383
open_info_title: "Öffnet die Programm-Info",
8484
lang_switch_aria: "Sprache",
85-
lang_de_title: "Deutsch",
86-
lang_en_title: "English",
85+
lang_toggle_title_to_en: "Zu Englisch wechseln",
86+
lang_toggle_title_to_de: "Zu Deutsch wechseln",
8787
notify_services_title: "Notification services",
8888
runners_title: "Runners",
8989
add_service: "+ Dienst",
@@ -243,8 +243,8 @@ const I18N = {
243243
no_changes: "No changes",
244244
open_info_title: "Open program info",
245245
lang_switch_aria: "Language",
246-
lang_de_title: "German",
247-
lang_en_title: "English",
246+
lang_toggle_title_to_en: "Switch to English",
247+
lang_toggle_title_to_de: "Switch to German",
248248
notify_services_title: "Notification services",
249249
runners_title: "Runners",
250250
add_service: "+ Service",
@@ -454,18 +454,11 @@ function applyLanguageToStaticDom() {
454454
infoEn.classList.toggle("hidden", !showEn);
455455
}
456456

457-
const langSwitch = el("langSwitch");
458-
if (langSwitch) langSwitch.setAttribute("aria-label", t("lang_switch_aria"));
459-
460-
const deBtn = el("langDeBtn");
461-
const enBtn = el("langEnBtn");
462-
if (deBtn) {
463-
deBtn.title = t("lang_de_title");
464-
deBtn.classList.toggle("primary", ui.lang !== "en");
465-
}
466-
if (enBtn) {
467-
enBtn.title = t("lang_en_title");
468-
enBtn.classList.toggle("primary", ui.lang === "en");
457+
const toggleBtn = el("langToggleBtn");
458+
if (toggleBtn) {
459+
toggleBtn.setAttribute("aria-label", t("lang_switch_aria"));
460+
toggleBtn.textContent = ui.lang === "en" ? "EN" : "DE";
461+
toggleBtn.title = ui.lang === "en" ? t("lang_toggle_title_to_de") : t("lang_toggle_title_to_en");
469462
}
470463

471464
// Keep buttons consistent even before the first state render completes.
@@ -2412,8 +2405,9 @@ async function wireUI() {
24122405
const closeInfoBtn = el("closeInfoBtn");
24132406
const infoModal = el("infoModal");
24142407

2415-
el("langDeBtn")?.addEventListener("click", () => setLanguage("de"));
2416-
el("langEnBtn")?.addEventListener("click", () => setLanguage("en"));
2408+
el("langToggleBtn")?.addEventListener("click", () => {
2409+
setLanguage(ui.lang === "en" ? "de" : "en");
2410+
});
24172411

24182412
openInfoTitle?.addEventListener("click", () => setInfoModalOpen(true));
24192413
openInfoTitle?.addEventListener("keydown", (e) => {

static/style.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ h1 { font-size: 20px; margin: 0; }
2121
}
2222
#topHeader { gap: 12px; }
2323
.headerRight { display: flex; align-items: center; gap: 10px; min-width: 0; }
24-
.langSwitch { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
25-
.langSwitch .btn { padding: 8px 10px; min-width: 46px; }
24+
.langToggle { padding: 8px 10px; min-width: 50px; font-weight: 650; }
2625
#flashDock {
2726
position: relative;
2827
width: clamp(240px, 40vw, 520px);

templates/index.html

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@
1111
<header class="row between center" id="topHeader">
1212
<h1 id="openInfoTitle" class="titleInfoTrigger" role="button" tabindex="0" title="Öffnet die Programm-Info">command-runner</h1>
1313
<div class="headerRight">
14-
<div class="row gap center wrapline">
15-
<div class="langSwitch" id="langSwitch" aria-label="Sprache">
16-
<button id="langDeBtn" class="btn" type="button" title="Deutsch">DE</button>
17-
<button id="langEnBtn" class="btn" type="button" title="English">EN</button>
18-
</div>
19-
<div class="row gap center" id="runningStatus">
20-
<div class="spinner hidden" id="globalSpinner"></div>
21-
<span class="small" id="runningCount"></span>
22-
</div>
14+
<div class="row gap center" id="runningStatus">
15+
<div class="spinner hidden" id="globalSpinner"></div>
16+
<span class="small" id="runningCount"></span>
2317
</div>
2418
<div id="flashDock">
2519
<div id="uiFlash" class="flash info" aria-live="polite"></div>
2620
</div>
21+
<button id="langToggleBtn" class="btn langToggle" type="button" aria-label="Sprache" title="DE/EN">DE</button>
2722
</div>
2823
</header>
2924

0 commit comments

Comments
 (0)