Files
Reims-Go/internal/installguide/picker_windows.go
T
Dnyo666 ceeec602be feat(i18n,plugin): implement end-to-end i18n & L10n v2 architecture and language pack protocol
- Build single-source-of-truth 7-domain locale catalog (`locales/{zh-CN,en-US}/*.json`, 1,100+ keys) and `cmd/i18ngen` generator emitting Go catalogs and eager/lazy-split TypeScript domain modules (`core`/`vm` eager; `wizard`/`settings`/`plugins` lazy)
- Add zero-dependency ICU MessageFormat subset (`{var}`, `{n, number}`, CLDR `plural`, `select`), 8-hop cycle-free regional fallback (`zh-HK/zh-MO -> zh-Hant -> zh-TW -> zh-CN`), `auto` OS display-language preference, and `en-XA` pseudo-localization across Go and TypeScript
- Introduce `CodedError` supportability with `[E_CODE]` badges, collapsible `[detail]` diagnostics, and automatic SMC OSK / SMBIOS serial / MAC / token redaction
- Add Host × Guest macOS dual-terminology annotation (`FormatGuestTerm`) across 6 official Apple guest UI locales and localize Win32 system tray, file pickers, and DPI-adaptive `installguide` overlays with CJK font fallback probing
- Upgrade L1–L4 plugin localization to dual-track v2: Track A full language packs (`files`, WOFF2 `fonts`, cross-plugin `pluginOverrides`), Track B plugin-scoped `l10n` bundles (`HasUIMessages` isolation), live `plugin/localeChanged` notifications, `< 2ms` static CLI pack loading, and `reims-go plugin locale init|check` translator toolchain with `zh-TW` and `ja-JP` reference packs
- Harden security, WCAG 2.1 AA token contrast, `< 768px` responsive drawer & form layouts, and RTL logical properties; add backend security/locale regression tests and frontend `node --test` static/runtime guard suite in CI

# Conflicts:
#	frontend/src/i18n.ts
#	internal/cli/cli.go
#	internal/i18n/i18n.go
2026-11-30 14:56:19 +08:00

55 lines
1.9 KiB
Go

package installguide
import (
"fmt"
"syscall"
"unicode/utf16"
"unsafe"
"github.com/Nwflower/reims-go/internal/i18n"
)
// OPENFILENAMEW for the native chooser owned by the guest overlay.
type openFileName struct {
size uint32
owner, instance uintptr
filter, customFilter *uint16
maxCustomFilter, filterIndex uint32
file *uint16
maxFile uint32
fileTitle *uint16
maxFileTitle uint32
initialDir, title *uint16
flags uint32
fileOffset, fileExtension uint16
defaultExt *uint16
customData, hook uintptr
templateName *uint16
reserved uintptr
reservedCount, flagsEx uint32
}
var (
comdlg32 = syscall.NewLazyDLL("comdlg32.dll")
procGetOpenFileNameW = comdlg32.NewProc("GetOpenFileNameW")
procCommDlgExtendedError = comdlg32.NewProc("CommDlgExtendedError")
)
func chooseImage(owner uintptr, locale i18n.Locale) (string, error) {
title := i18n.T(locale, "guide.picker.title")
label := i18n.T(locale, "guide.picker.filter")
titleW, _ := syscall.UTF16PtrFromString(title)
filter := utf16.Encode([]rune(label + " (*.img, *.dmg)\x00*.img;*.dmg\x00\x00"))
file := make([]uint16, 32768)
opts := openFileName{owner: owner, filter: &filter[0], filterIndex: 1, file: &file[0], maxFile: uint32(len(file)), title: titleW,
flags: 0x80000 | 0x1000 | 0x800 | 0x8} // Explorer; existing path/file; preserve current directory.
opts.size = uint32(unsafe.Sizeof(opts))
if ok, _, _ := procGetOpenFileNameW.Call(uintptr(unsafe.Pointer(&opts))); ok != 0 {
return syscall.UTF16ToString(file), nil
}
if code, _, _ := procCommDlgExtendedError.Call(); code != 0 {
return "", fmt.Errorf("file dialog: %#x", code)
}
return "", nil
}