Skip to content

Fix macOS native menu bar reverting to English after restart (#11505)#11508

Merged
niksedk merged 1 commit into
mainfrom
fix-macos-menu-bar-language
Jun 9, 2026
Merged

Fix macOS native menu bar reverting to English after restart (#11505)#11508
niksedk merged 1 commit into
mainfrom
fix-macos-menu-bar-language

Conversation

@niksedk

@niksedk niksedk commented Jun 9, 2026

Copy link
Copy Markdown
Member

Fixes #11505.

Problem

On macOS, after changing the UI language and restarting SE, the native top menu bar (File, Edit, Tools, …) shows in English even though the rest of the window is correctly localized.

Root cause

The native NSMenuBar is built in Program.Main immediately after SetupMainWindow, and InitNativeMacMenu.MakeStructure reads Se.Language directly. But the translation was loaded inside MainView.Build(), which (as an Avalonia.Markup.Declarative ViewBase) runs lazily on attach during lifetime.Start() — i.e. after the native menu has already been constructed from the default English strings.

Runtime language switches were never affected because they call InitNativeMacMenu.Rebuild().

Fix

  • Add Se.LoadLanguage() — loads the translation named in settings into Se.Language (English / missing / unreadable file ⇒ English defaults, errors logged).
  • Call it in Program.Main right after Se.LoadSettings(), before any window or the native menu bar is built. This is the actual fix.
  • Replace the duplicated inline load in MainView with the shared call (and drop two now-unused imports).
  • Also fix a pre-existing build warning: DataGridRow.GetIndex() (obsolete) → .Index.

Build is 0 warnings, 0 errors.

Verification

Confirmed on macOS (Apple Silicon): set UI language to a non-English translation, restart — the native menu bar now appears localized. English startup path verified healthy.

🤖 Generated with Claude Code

The macOS NSMenuBar is built in Program.Main (right after SetupMainWindow)
and InitNativeMacMenu.MakeStructure reads Se.Language directly. But the UI
translation was loaded inside MainView.Build(), which runs lazily on attach
during lifetime.Start() — after the native menu is already constructed. So
on restart the menu bar was built from the default English strings even
though the rest of the UI localized correctly. (Runtime language changes
were unaffected because they call InitNativeMacMenu.Rebuild.)

- Add Se.LoadLanguage(): loads the configured translation into Se.Language
- Call it in Program.Main right after LoadSettings(), before any window or
  the native menu bar is built
- Replace the duplicated inline load in MainView with the shared call
- Also fix a pre-existing warning: DataGridRow.GetIndex() (obsolete) -> .Index

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@niksedk niksedk merged commit dbad969 into main Jun 9, 2026
1 of 3 checks passed
@niksedk niksedk deleted the fix-macos-menu-bar-language branch June 9, 2026 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[v5.0.0-RC3] UI language for macOS menu bar resets to English after restarting SE5

1 participant