opencode-provider-switch/internal/desktop/tray_language_windows.go
apale7 8fc72e87e4 fix(desktop): finish Windows shell polish
Stabilize the tray icon and locale handling on Windows while aligning provider and alias management panels with the refreshed desktop branding.
2026-04-20 02:36:54 +08:00

21 lines
464 B
Go

//go:build desktop_wails && windows
package desktop
import (
"syscall"
"unsafe"
)
func detectSystemTrayLanguage() string {
const localeNameMaxLength = 85
kernel32 := syscall.NewLazyDLL("kernel32.dll")
proc := kernel32.NewProc("GetUserDefaultLocaleName")
var buffer [localeNameMaxLength]uint16
result, _, _ := proc.Call(uintptr(unsafe.Pointer(&buffer[0])), uintptr(len(buffer)))
if result == 0 {
return ""
}
return syscall.UTF16ToString(buffer[:])
}