From 23fd4360911f3a14e655f0882916f7ddfedaed4d Mon Sep 17 00:00:00 2001 From: omartelo Date: Sat, 17 Oct 2026 19:30:10 -0300 Subject: [PATCH] fix(native): reread the patch notes when the interface language changes --- CHANGELOG.md | 6 ++++++ native/cmd/lich-native/settings_language.go | 1 + native/cmd/lich-native/settings_language_test.go | 14 ++++++++++++++ native/cmd/lich-native/sidebar_prefs_test.go | 2 ++ 4 files changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fdaba94d..f79883db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- **What's new follows a language you switch to.** In the native window, the + release notes stayed in the language they were first read in after you + changed the interface language, under group names in the new one. + ## [0.70.0] - 2026-10-17 ### Added diff --git a/native/cmd/lich-native/settings_language.go b/native/cmd/lich-native/settings_language.go index 69611252..07ac0ded 100644 --- a/native/cmd/lich-native/settings_language.go +++ b/native/cmd/lich-native/settings_language.go @@ -146,6 +146,7 @@ func (s *settingsScreen) chooseLanguage(l i18n.Locale) { func (s *settingsScreen) keepLanguage(l i18n.Locale) { i18n.SetCurrent(l) s.invalidate() + go s.updates.readNotes(s) go func() { if err := s.client.SetSetting(s.ctx, uiLanguageKey, "", string(l)); err != nil { log.Printf("settings: save %s: %v", uiLanguageKey, err) diff --git a/native/cmd/lich-native/settings_language_test.go b/native/cmd/lich-native/settings_language_test.go index 6c888e49..210d8f59 100644 --- a/native/cmd/lich-native/settings_language_test.go +++ b/native/cmd/lich-native/settings_language_test.go @@ -190,3 +190,17 @@ func TestAFailedOrCanceledDownloadKeepsTheLanguage(t *testing.T) { t.Errorf("current %s", i18n.Current()) } } + +// The notes are read once and kept; a new interface language reads them +// again, or the dialog names its groups in one language and lists them in +// the other. +func TestChoosingALanguageRereadsThePatchNotes(t *testing.T) { + s := languageScreen(t) + s.updates.readNotes(s) + s.keepLanguage(i18n.RU) + eventually(t, "the notes in Russian", func() bool { + s.updates.mu.Lock() + defer s.updates.mu.Unlock() + return s.updates.notes.Groups[0].Items[0] == string(i18n.RU) + }) +} diff --git a/native/cmd/lich-native/sidebar_prefs_test.go b/native/cmd/lich-native/sidebar_prefs_test.go index cd5920c7..89dc3050 100644 --- a/native/cmd/lich-native/sidebar_prefs_test.go +++ b/native/cmd/lich-native/sidebar_prefs_test.go @@ -72,6 +72,8 @@ func (f *sidebarBackend) answer(method string, args []json.RawMessage) any { _ = json.Unmarshal(args[0], &opts) f.settings["appearance.theme@"] = opts.ID return nil + case "patchnotes.Current": + return lichclient.PatchNotes{Version: "1.0.0", Groups: []lichclient.PatchNotesGroup{{Label: "Added", Items: []string{str(0)}}}} case "themes.SetFollowSystem": f.settings["appearance.followSystem@"] = string(args[0]) return nil