mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-24 12:44:18 +08:00
997be22bfa
The tray menu used a hardcoded zh (Simplified Chinese) fallback whenever settings.language was unset (i.e. first install). On systems whose UI language resolves to Traditional Chinese / Japanese / English via the frontend's navigator-based detection, the tray therefore showed Simplified Chinese until the user manually switched language once. Detect the OS locale via the sys-locale crate and map it to a supported tray language, mirroring the frontend getInitialLanguage precedence (zh-TW/HK/MO/Hant -> zh-TW, other zh -> zh, ja -> ja, en -> en, otherwise zh). This keeps the tray consistent with the UI from the first launch with no timing window. An explicitly stored settings.language still takes precedence, so user choices are never overridden. Adds unit tests for the locale mapping. Co-authored-by: LaiYueTing <LaiYueTing@users.noreply.github.com> Co-authored-by: Jason <farion1231@gmail.com>