45bfae6e94
Initial import of all source code, config, and README assets: the packages workspace (cli, core, server, web, docs, landing, skills), build scripts, tooling config, and CI workflows. Includes the data-layout revision made on this branch: the local data root defaults to ~/.penguin/data (PENGUIN_HOME still overrides; the installer keeps its binaries in ~/.penguin), and every Agent lives under <project>/agents/<agent>/ — path helpers, the three agent-enumeration scans, the system prompt, built-in Skills, tests and docs all follow the new layout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018ihk8iQuo3kv2aPjAYEPuR
21 lines
781 B
TypeScript
21 lines
781 B
TypeScript
/**
|
||
* locale.tsx unit tests: device language resolution (language follows
|
||
* navigator.language when no stored preference exists; language/theme
|
||
* initialization does not depend on login state and also applies on the
|
||
* login page).
|
||
*/
|
||
import { describe, expect, it } from "vitest";
|
||
import { resolveSystemLocale } from "../src/state/locale";
|
||
|
||
describe("resolveSystemLocale(navigator.language → 界面语言)", () => {
|
||
it("zh 前缀(任意大小写与地区变体)→ zh", () => {
|
||
expect(resolveSystemLocale("zh-CN")).toBe("zh");
|
||
expect(resolveSystemLocale("ZH-TW")).toBe("zh");
|
||
});
|
||
|
||
it("非中文或取不到 → 英文兜底", () => {
|
||
expect(resolveSystemLocale("en-US")).toBe("en");
|
||
expect(resolveSystemLocale(undefined)).toBe("en");
|
||
});
|
||
});
|