From efdc5c5e1d13bcf3fcf0b70bf051c3c1f95d4912 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Thu, 20 Aug 2026 20:44:51 +0800 Subject: [PATCH] fix(config): restate the Explorer verbs when a hand-edited language changes --- src/core/explorer_context_menu.rs | 4 ++-- src/main.rs | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/core/explorer_context_menu.rs b/src/core/explorer_context_menu.rs index 70174995..7c375507 100644 --- a/src/core/explorer_context_menu.rs +++ b/src/core/explorer_context_menu.rs @@ -42,8 +42,8 @@ impl Location { /// written here is what a user sees until something writes it again — an /// install-time snapshot of the locale. Two things keep that snapshot /// honest: `register` sets the locale from the config before building the - /// entries, and [`refresh_labels`] restates them when the language changes - /// in Settings. + /// entries, and [`refresh_labels`] restates them whenever the language + /// changes — from the picker in Settings or from a hand-edited config. fn label(self) -> &'static str { t(match self { Self::Directory => L10nKey::ExplorerMenuOpenIn, diff --git a/src/main.rs b/src/main.rs index 5a306c15..a7fc9324 100644 --- a/src/main.rs +++ b/src/main.rs @@ -130,6 +130,12 @@ fn apply_reloaded_config( // alone, so there is nothing to compare and the user's keys stay in the // keymap the app is dispatching on. let keymap_before = crate::ui::keymap::keybinding_config(cx); + // Explorer's verbs live in the registry rather than in this process, so a + // hand-edited `gui_language` leaves them behind unless something restates + // them. Gated on the language actually moving, for the same reason the + // keymap below is: this watcher fires on every config write, and a sidebar + // drag has no business touching the registry. + let language_changed = cx.global::().gui_language != config.gui_language; crate::ui::i18n::set_locale(&config.gui_language); cx.set_global(config); reload_themes(cx); @@ -138,6 +144,9 @@ fn apply_reloaded_config( // gui_language by hand has to rebuild it the same way the in-app language // picker does. crate::ui::theme::set_menus(cx); + if language_changed { + crate::core::explorer_context_menu::refresh_labels(); + } crate::ui::windows::WindowRegistry::refresh_locale(cx, None); // `custom_shells` is only ever hand-edited, so this file is the one place // it can change from — and the inventory that carries it to the new-tab