diff --git a/src/app/[locale]/admin/agents/page.tsx b/src/app/[locale]/admin/agents/page.tsx index d63adf4e..fef0305b 100644 --- a/src/app/[locale]/admin/agents/page.tsx +++ b/src/app/[locale]/admin/agents/page.tsx @@ -50,6 +50,7 @@ export default function AdminAgentsPage() { const [editingId, setEditingId] = useState(null); const [draft, setDraft] = useState([]); const t = useTranslations("Admin"); + const tScenario = useTranslations("Scenarios"); const load = useCallback(async () => { setLoading(true); @@ -152,7 +153,7 @@ export default function AdminAgentsPage() { className="inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full bg-purple-50 text-purple-600" > {sc.emoji} - {sc.nameZh} + {tScenario(slug)} ) : null; })} diff --git a/src/components/LocaleSwitcher.tsx b/src/components/LocaleSwitcher.tsx index 0e5eb018..660bfdf8 100644 --- a/src/components/LocaleSwitcher.tsx +++ b/src/components/LocaleSwitcher.tsx @@ -8,12 +8,17 @@ import { routing } from "@/i18n/routing"; import { LOCALE_META } from "@/lib/locales"; /** - * Language selector. Switches the active locale while preserving the current - * path and query string. Uses next-intl's locale-aware router so the locale - * prefix is added/removed automatically (default locale stays unprefixed). + * Compact language selector. The visible chip shows only the uppercase locale + * code (e.g. `EN`, `ZH`) so its width stays small and fixed regardless of how + * long the active language's native name is (e.g. "Bahasa Indonesia"). A + * transparent native on top: drives selection + a11y, while the + OS option list still shows full native language names. */} - - - ); } diff --git a/src/components/ui/AgentCard.tsx b/src/components/ui/AgentCard.tsx index 8ef6eab4..b4b8eb5e 100644 --- a/src/components/ui/AgentCard.tsx +++ b/src/components/ui/AgentCard.tsx @@ -1,7 +1,7 @@ import { getTranslations } from "next-intl/server"; import { Link } from "@/i18n/navigation"; import { Zap, Layers, Star, GitFork } from "lucide-react"; -import { findScenario, scenarioLabel } from "@/lib/scenarios"; +import { findScenario } from "@/lib/scenarios"; // Minimal translator shape so priceLabel can be called with or without i18n. type Translator = (key: string, values?: Record) => string; @@ -57,6 +57,7 @@ function formatStars(n: number): string { export default async function AgentCard({ agent }: { agent: AgentCardData }) { const t = await getTranslations("Components"); + const tScenario = await getTranslations("Scenarios"); const isProject = agent.kind === "PROJECT"; return ( { const sc = findScenario(slug); if (!sc) return null; + const label = tScenario(slug); return ( {sc.emoji} - {sc.nameZh} + {label} ); })}