Localize macOS application menu and correct AITURK package checks

This commit is contained in:
2026-09-06 05:29:21 +03:00
parent 5e76f58637
commit 7724d65e92
12 changed files with 296 additions and 28 deletions
+21 -2
View File
@@ -261,6 +261,7 @@ import {
resolveOauthRestAuth,
resolveReadinessProbeAuth
} from './native-auth-decisions'
import { localizeNativeMenu, type NativeMenuLocale, resolveNativeMenuLocale } from './native-menu-locale'
import {
nativeRefreshUrl,
type NativeTokenSet,
@@ -6755,11 +6756,13 @@ function sendWindowStateChanged(nextIsFullscreen?: boolean, target = mainWindow)
webContents.send('hermes:window-state-changed', state)
}
let nativeMenuLocale: NativeMenuLocale = 'tr'
function buildApplicationMenu() {
const template = []
const checkForUpdatesItem = {
label: 'AITURK IDE güncellemeleri…',
label: 'Check for Updates…',
click: () => IS_PACKAGED ? void shell.openExternal(AITURK_PRODUCT.downloads) : sendOpenUpdatesRequested()
}
@@ -6886,7 +6889,7 @@ function buildApplicationMenu() {
submenu: [checkForUpdatesItem]
})
return Menu.buildFromTemplate(template)
return Menu.buildFromTemplate(localizeNativeMenu(template, nativeMenuLocale, APP_NAME))
}
function toggleDevTools(window) {
@@ -16955,6 +16958,22 @@ ipcMain.on('hermes:titlebar-theme', (_event, payload) => {
}
})
// Language stays in backend display.language; this only updates native labels.
ipcMain.on('hermes:ui-language', (event, locale) => {
if (!IS_MAC) {
return
}
const next = resolveNativeMenuLocale(locale, event.sender.id, mainWindow?.webContents.id)
if (next === null || next === nativeMenuLocale) {
return
}
nativeMenuLocale = next
Menu.setApplicationMenu(buildApplicationMenu())
})
// Pin the native appearance to the app theme (see NATIVE_THEME_CONFIG_PATH).
ipcMain.on('hermes:native-theme', (_event, mode) => {
if (!THEME_SOURCES.has(mode)) {