Files
Auto-Trader/frontend/src/lib/swarmI18n.ts
T
Kenneth Hau aab57cdeb3
Desktop Windows / package (push) Waiting to run
Build and Push Docker Image / validate-build (push) Waiting to run
Build and Push Docker Image / build-and-push (push) Skipped
CI / Hash lock / macOS ARM64 (push) Waiting to run
CI / Hash lock / Linux x64 (push) Waiting to run
CI / Hash lock / Windows x64 (push) Waiting to run
CI / test / Python 3.11 (push) Waiting to run
CI / test / Python 3.14 (push) Waiting to run
CI / frontend (push) Waiting to run
CI / Windows 11 ARM64 / Python 3.14 background lifecycle (push) Waiting to run
CI / Windows Server 2025 x64 / Python 3.14 background lifecycle (push) Waiting to run
CI / Windows desktop source lifecycle (push) Waiting to run
Deploy Wiki / Deploy to Cloudflare Pages (push) Waiting to run
Wiki / validate (push) Waiting to run
feat: Phase 0/1 TradingAgents swarm graft, mandate paper automation, and P0 WhatsApp outbound send
2026-10-16 14:58:47 +08:00

52 lines
1.5 KiB
TypeScript

export type ManifestTranslation = (
key: string,
options?: Record<string, string | number>,
) => string;
export const STATUS_TRANSLATION_KEYS = {
waiting: "swarm.status.waiting",
running: "swarm.status.running",
done: "swarm.status.done",
failed: "swarm.status.failed",
blocked: "swarm.status.blocked",
retry: "swarm.status.retry",
cancelled: "swarm.status.cancelled",
pending: "swarm.status.pending",
completed: "swarm.status.completed",
unknown: "swarm.status.unknown",
} as const;
const PRESET_WELCOME_KEYS: Record<string, string> = {
investment_committee: "welcome.examples.investmentCommittee",
quant_strategy_desk: "welcome.examples.quantStrategyDesk",
value_investing_committee: "welcome.examples.valueCommittee",
};
const PRESET_DEFAULT_LABELS: Record<string, string> = {
trading_agents: "TradingAgents Decision Pipeline",
};
export function localizeStatus(
status: keyof typeof STATUS_TRANSLATION_KEYS,
t: ManifestTranslation,
): string {
return t(STATUS_TRANSLATION_KEYS[status]);
}
export function localizePreset(
preset: string,
t: ManifestTranslation,
): string {
const humanized =
PRESET_DEFAULT_LABELS[preset] ??
preset
.replace(/_/g, " ")
.replace(/^\p{L}/u, (letter) => letter.toLocaleUpperCase());
const welcomeKey = PRESET_WELCOME_KEYS[preset];
const fallback = welcomeKey
? t(welcomeKey, { defaultValue: humanized })
: humanized;
return t(`swarm.presets.${preset}`, { defaultValue: fallback });
}