fix(config): restate the Explorer verbs when a hand-edited language changes

This commit is contained in:
l0ng-ai
2026-08-20 20:44:51 +08:00
parent 94e0524249
commit efdc5c5e1d
2 changed files with 11 additions and 2 deletions
+2 -2
View File
@@ -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,
+9
View File
@@ -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::<Config>().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