mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 13:07:39 +00:00
* docs: add ACP persistent binding experiment plan * docs: align ACP persistent binding spec to channel-local config * docs: scope Telegram ACP bindings to forum topics only * docs: lock bound /new and /reset behavior to in-place ACP reset * ACP: add persistent discord/telegram conversation bindings * ACP: fix persistent binding reuse and discord thread parent context * docs: document channel-specific persistent ACP bindings * ACP: split persistent bindings and share conversation id helpers * ACP: defer configured binding init until preflight passes * ACP: fix discord thread parent fallback and explicit disable inheritance * ACP: keep bound /new and /reset in-place * ACP: honor configured bindings in native command flows * ACP: avoid configured fallback after runtime bind failure * docs: refine ACP bindings experiment config examples * acp: cut over to typed top-level persistent bindings * ACP bindings: harden reset recovery and native command auth * Docs: add ACP bound command auth proposal * Tests: normalize i18n registry zh-CN assertion encoding * ACP bindings: address review findings for reset and fallback routing * ACP reset: gate hooks on success and preserve /new arguments * ACP bindings: fix auth and binding-priority review findings * Telegram ACP: gate ensure on auth and accepted messages * ACP bindings: fix session-key precedence and unavailable handling * ACP reset/native commands: honor fallback targets and abort on bootstrap failure * Config schema: validate ACP binding channel and Telegram topic IDs * Discord ACP: apply configured DM bindings to native commands * ACP reset tails: dispatch through ACP after command handling * ACP tails/native reset auth: fix target dispatch and restore full auth * ACP reset detection: fallback to active ACP keys for DM contexts * Tests: type runTurn mock input in ACP dispatch test * ACP: dedup binding route bootstrap and reset target resolution * reply: align ACP reset hooks with bound session key * docs: replace personal discord ids with placeholders * fix: add changelog entry for ACP persistent bindings (#34873) (thanks @dutifulbob) --------- Co-authored-by: Onur <2453968+osolmaz@users.noreply.github.com>
50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
DEFAULT_LOCALE,
|
|
SUPPORTED_LOCALES,
|
|
loadLazyLocaleTranslation,
|
|
resolveNavigatorLocale,
|
|
} from "../../ui/src/i18n/lib/registry.ts";
|
|
import type { TranslationMap } from "../../ui/src/i18n/lib/types.ts";
|
|
|
|
function getNestedTranslation(map: TranslationMap | null, ...path: string[]): string | undefined {
|
|
let value: string | TranslationMap | undefined = map ?? undefined;
|
|
for (const key of path) {
|
|
if (value === undefined || typeof value === "string") {
|
|
return undefined;
|
|
}
|
|
value = value[key];
|
|
}
|
|
return typeof value === "string" ? value : undefined;
|
|
}
|
|
|
|
describe("ui i18n locale registry", () => {
|
|
it("lists supported locales", () => {
|
|
expect(SUPPORTED_LOCALES).toEqual(["en", "zh-CN", "zh-TW", "pt-BR", "de", "es"]);
|
|
expect(DEFAULT_LOCALE).toBe("en");
|
|
});
|
|
|
|
it("resolves browser locale fallbacks", () => {
|
|
expect(resolveNavigatorLocale("de-DE")).toBe("de");
|
|
expect(resolveNavigatorLocale("es-ES")).toBe("es");
|
|
expect(resolveNavigatorLocale("es-MX")).toBe("es");
|
|
expect(resolveNavigatorLocale("pt-PT")).toBe("pt-BR");
|
|
expect(resolveNavigatorLocale("zh-HK")).toBe("zh-TW");
|
|
expect(resolveNavigatorLocale("en-US")).toBe("en");
|
|
});
|
|
|
|
it("loads lazy locale translations from the registry", async () => {
|
|
const de = await loadLazyLocaleTranslation("de");
|
|
const es = await loadLazyLocaleTranslation("es");
|
|
const ptBR = await loadLazyLocaleTranslation("pt-BR");
|
|
const zhCN = await loadLazyLocaleTranslation("zh-CN");
|
|
|
|
expect(getNestedTranslation(de, "common", "health")).toBe("Status");
|
|
expect(getNestedTranslation(es, "common", "health")).toBe("Estado");
|
|
expect(getNestedTranslation(es, "languages", "de")).toBe("Deutsch (Alemán)");
|
|
expect(getNestedTranslation(ptBR, "languages", "es")).toBe("Español (Espanhol)");
|
|
expect(getNestedTranslation(zhCN, "common", "health")).toBe("\u5065\u5eb7\u72b6\u51b5");
|
|
expect(await loadLazyLocaleTranslation("en")).toBeNull();
|
|
});
|
|
});
|