From 00ef11ac33a608c6c85ae47f50b65d0308665a04 Mon Sep 17 00:00:00 2001 From: mika kuns Date: Wed, 3 Jun 2026 13:17:21 +0200 Subject: [PATCH] fix(i18n): live-refresh smart/virtual list names on language change Smart-list nav labels were localized only at load; subscribe the singleton ListsIslandViewModel to language changes and re-localize names in place. Co-Authored-By: Claude Opus 4.7 --- .../Islands/ListsIslandViewModel.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs index cf9b11b..cd14462 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/ListsIslandViewModel.cs @@ -162,6 +162,26 @@ public sealed partial class ListsIslandViewModel : ViewModelBase _worker.WorktreeUpdatedEvent += _id => _ = RefreshCountsAsync(); _worker.ConnectionRestoredEvent += () => _ = RefreshCountsAsync(); } + + Loc.LanguageChanged += (_, _) => RefreshLocalizedLabels(); + } + + private static string? SmartListNameKey(string id) => id switch + { + "smart:my-day" => "vm.lists.smartMyDay", + "smart:important" => "vm.lists.smartImportant", + "smart:planned" => "vm.lists.smartPlanned", + "virtual:queued" => "vm.lists.virtualQueue", + "virtual:running" => "vm.lists.virtualRunning", + "virtual:review" => "vm.lists.virtualReview", + _ => null, + }; + + private void RefreshLocalizedLabels() + { + foreach (var item in SmartLists) + if (SmartListNameKey(item.Id) is { } key) item.Name = Loc.T(key); + OnPropertyChanged(nameof(MachineNameLocal)); } public async Task LoadAsync(CancellationToken ct = default)