From 2284d42695311213b149d0eeda023f3966d007b8 Mon Sep 17 00:00:00 2001 From: Michael Lam Date: Sat, 16 May 2026 04:31:16 -0700 Subject: [PATCH] fix: interpolate German session time labels --- CHANGELOG.md | 4 ++++ static/i18n.js | 6 +++--- tests/test_session_sidebar_relative_time.py | 9 +++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fa25bab..6434724c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Fixed + +- **PR #2381** by @Michaelyklam (fixes #2379) — German relative session-time labels now interpolate the elapsed value instead of rendering the literal `{n}` placeholder in the sidebar/header. The German locale now uses function-valued translations for minutes, hours, and days, matching the other locale bundles. + ## [v0.51.74] — 2026-05-16 — Release AX (stage-367 — 4-PR safe-lane batch — #2362 table-cell spacing + #2363 run-state-consistency RFC + #2365 custom_providers list-format + #2367 settings sidebar i18n) ### Added diff --git a/static/i18n.js b/static/i18n.js index 30c497f1..71860fd6 100644 --- a/static/i18n.js +++ b/static/i18n.js @@ -6581,9 +6581,9 @@ const LOCALES = { session_toolsets_cleared: 'Toolsets cleared — using global config', // TODO: translate session_toolsets_failed: 'Failed to update toolsets: ', // TODO: translate session_time_unknown: 'Unbekannt', - session_time_minutes_ago: 'Vor {n} Minuten', - session_time_hours_ago: 'Vor {n} Stunden', - session_time_days_ago: 'Vor {n} Tagen', + session_time_minutes_ago: (n) => `Vor ${n} Minuten`, + session_time_hours_ago: (n) => `Vor ${n} Stunden`, + session_time_days_ago: (n) => `Vor ${n} Tagen`, session_time_last_week: 'Letzte Woche', session_time_bucket_today: 'Heute', session_time_bucket_yesterday: 'Gestern', diff --git a/tests/test_session_sidebar_relative_time.py b/tests/test_session_sidebar_relative_time.py index 5aa95be8..84697dec 100644 --- a/tests/test_session_sidebar_relative_time.py +++ b/tests/test_session_sidebar_relative_time.py @@ -169,3 +169,12 @@ def test_relative_time_strings_are_localized_in_english_and_spanish_bundles(): "session_time_bucket_older", ): assert key in I18N_JS + + +def test_german_relative_time_translations_interpolate_numbers(): + assert "session_time_minutes_ago: (n) => `Vor ${n} Minuten`" in I18N_JS + assert "session_time_hours_ago: (n) => `Vor ${n} Stunden`" in I18N_JS + assert "session_time_days_ago: (n) => `Vor ${n} Tagen`" in I18N_JS + assert "session_time_minutes_ago: 'Vor {n} Minuten'" not in I18N_JS + assert "session_time_hours_ago: 'Vor {n} Stunden'" not in I18N_JS + assert "session_time_days_ago: 'Vor {n} Tagen'" not in I18N_JS