From b085fdca4c6a88b3058dc22d006a8bbbc5563b54 Mon Sep 17 00:00:00 2001 From: Myisha Kagamine <002.aureai@gmail.com> Date: Thu, 20 Aug 2026 11:04:26 +0300 Subject: [PATCH] macOS: fix duplicate Window menu in translated UIs wx locates the macOS Window menu by comparing each top-level menu title against wxApp::s_macWindowMenuTitleName and against its own translation of "Window" (context "macOS menu name"). Aegisub never sets the former, so in any non-English UI the menubar's translated Window title matches neither and wxMenuBarCocoaImpl::MacCreateOrFindWindowMenu() falls through to creating a second, untranslated "Window" menu, inserting it after Help. The result is two Window menus side by side, e.g. "Pencere" and "Window" in a Turkish UI. Every translated macOS build is affected. Set s_macWindowMenuTitleName from the menubar's already-translated title, mirroring how the Help menu title is handled, and mark the macOS menubar's Window entry so it can be recognised. Since wx then matches Aegisub's own menu, no extra menu is created and the title stays translated. Co-Authored-By: Claude Opus 5 --- src/libresrc/osx/default_menu.json | 2 +- src/menu.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libresrc/osx/default_menu.json b/src/libresrc/osx/default_menu.json index 5e2a8a77c9..f07077d8c8 100644 --- a/src/libresrc/osx/default_menu.json +++ b/src/libresrc/osx/default_menu.json @@ -8,7 +8,7 @@ { "submenu" : "main/video", "tlcontext": "Menu bar", "text" : "&Video" }, { "submenu" : "main/audio", "tlcontext": "Menu bar", "text" : "&Audio" }, { "special" : "automation", "tlcontext": "Menu bar", "text" : "A&utomation" }, - { "submenu" : "main/window", "tlcontext": "Menu bar", "text" : "Window" }, + { "submenu" : "main/window", "tlcontext": "Menu bar", "text" : "Window", "special" : "window" }, { "submenu" : "main/help", "tlcontext": "Menu bar", "text" : "&Help", "special" : "help" } ], "main/file" : [ diff --git a/src/menu.cpp b/src/menu.cpp index 1052c3caf9..50dd6fa4d7 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -533,7 +533,17 @@ namespace menu { read_entry(item, "text", &disp); read_entry(item, "tlcontext", &context); if (!submenu.empty()) { - menu->Append(build_menu(submenu, c, &menu->cm), wxGetTranslation(to_wx(disp), {}, to_wx(context))); + wxString tl_disp = wxGetTranslation(to_wx(disp), {}, to_wx(context)); + menu->Append(build_menu(submenu, c, &menu->cm), tl_disp); +#ifdef __WXMAC__ + std::string special; + read_entry(item, "special", &special); + // wx finds the macOS Window menu by comparing menu titles, so it has to be + // given the translated one. Without this it fails to match a translated + // title and appends a second, untranslated "Window" menu of its own. + if (special == "window") + wxApp::s_macWindowMenuTitleName = tl_disp; +#endif } else { read_entry(item, "special", &submenu);