fix(i18n): localize compaction tooltips and add contact insert i18n keys

Replace hardcoded English tooltip strings in compaction config with
t() calls. Add insertContact, searchContacts, noContactsFound i18n
keys across en/vi/zh.
This commit is contained in:
viettranx committed 2026-03-10 18:46:44 +07:00
1 parent fffdc0b082
commit a3cc993515
5 files changed
+26 -21

No files matched your search

+5 -2
View File
@@ -147,7 +147,8 @@
"contextFile": "Context file",
"perUser": "per-user",
"emptyFile": "empty",
"estTokens": "Est {{tokens}} tokens"
"estTokens": "Est {{tokens}} tokens",
"insertContact": "Search contact to insert..."
},
"fileEditor": {
"editWithAi": "Edit with AI",
@@ -222,7 +223,9 @@
"loading": "Loading...",
"saving": "Saving...",
"save": "Save",
"saved": "Saved"
"saved": "Saved",
"searchContacts": "Search contacts to add...",
"noContactsFound": "No contacts found"
},
"summoning": {
"title": "Summoning Your Agent...",
+5 -2
View File
@@ -147,7 +147,8 @@
"contextFile": "Tệp ngữ cảnh",
"perUser": "theo người dùng",
"emptyFile": "trống",
"estTokens": "Ước {{tokens}} token"
"estTokens": "Ước {{tokens}} token",
"insertContact": "Tìm liên hệ để chèn..."
},
"fileEditor": {
"editWithAi": "Chỉnh sửa với AI",
@@ -222,7 +223,9 @@
"loading": "Đang tải...",
"saving": "Đang lưu...",
"save": "Lưu",
"saved": "Đã lưu"
"saved": "Đã lưu",
"searchContacts": "Tìm liên hệ để thêm...",
"noContactsFound": "Không tìm thấy liên hệ"
},
"summoning": {
"title": "Đang triệu hồi agent...",
+5 -2
View File
@@ -147,7 +147,8 @@
"contextFile": "上下文文件",
"perUser": "每用户",
"emptyFile": "空",
"estTokens": "估计 {{tokens}} token"
"estTokens": "估计 {{tokens}} token",
"insertContact": "搜索联系人以插入..."
},
"fileEditor": {
"editWithAi": "AI 编辑",
@@ -222,7 +223,9 @@
"loading": "加载中...",
"saving": "保存中...",
"save": "保存",
"saved": "已保存"
"saved": "已保存",
"searchContacts": "搜索联系人添加...",
"noContactsFound": "未找到联系人"
},
"summoning": {
"title": "正在召唤您的Agent...",
@@ -38,7 +38,6 @@ export function AgentConfigTab({ agent, onUpdate }: AgentConfigTabProps) {
const [toolsEnabled, setToolsEnabled] = useState(agent.tools_config != null);
const [tools, setTools] = useState<ToolPolicyConfig>(agent.tools_config ?? {});
const [compEnabled, setCompEnabled] = useState(agent.compaction_config != null);
const [comp, setComp] = useState<CompactionConfig>(agent.compaction_config ?? {});
const [pruneEnabled, setPruneEnabled] = useState(agent.context_pruning != null);
@@ -79,7 +78,7 @@ export function AgentConfigTab({ agent, onUpdate }: AgentConfigTabProps) {
const updates: Record<string, unknown> = {
subagents_config: subEnabled ? sub : null,
tools_config: toolsEnabled ? tools : {},
compaction_config: compEnabled ? comp : null,
compaction_config: comp,
context_pruning: pruneEnabled ? prune : null,
sandbox_config: sbEnabled ? sb : null,
memory_config: memEnabled ? mem : null,
@@ -146,9 +145,7 @@ export function AgentConfigTab({ agent, onUpdate }: AgentConfigTabProps) {
/>
<div className="space-y-4">
<CompactionSection
enabled={compEnabled}
value={comp}
onToggle={(v: boolean) => { setCompEnabled(v); if (!v) setComp({}); }}
onChange={setComp}
/>
<ContextPruningSection
@@ -2,25 +2,23 @@ import { useTranslation } from "react-i18next";
import { Input } from "@/components/ui/input";
import { Switch } from "@/components/ui/switch";
import type { CompactionConfig } from "@/types/agent";
import { ConfigSection, InfoLabel, numOrUndef } from "./config-section";
import { InfoLabel, numOrUndef } from "./config-section";
interface CompactionSectionProps {
enabled: boolean;
value: CompactionConfig;
onToggle: (v: boolean) => void;
onChange: (v: CompactionConfig) => void;
}
export function CompactionSection({ enabled, value, onToggle, onChange }: CompactionSectionProps) {
export function CompactionSection({ value, onChange }: CompactionSectionProps) {
const { t } = useTranslation("agents");
const s = "configSections.compaction";
return (
<ConfigSection
title={t(`${s}.title`)}
description={t(`${s}.description`)}
enabled={enabled}
onToggle={onToggle}
>
<section className="space-y-3">
<div>
<h3 className="text-sm font-medium">{t(`${s}.title`)}</h3>
<p className="text-xs text-muted-foreground">{t(`${s}.description`)}</p>
</div>
<div className="rounded-lg border p-3 space-y-4 sm:p-4">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
<div className="space-y-2">
<InfoLabel tip={t(`${s}.maxHistoryShareTip`)}>{t(`${s}.maxHistoryShare`)}</InfoLabel>
@@ -62,6 +60,7 @@ export function CompactionSection({ enabled, value, onToggle, onChange }: Compac
/>
<InfoLabel tip={t(`${s}.memoryFlushTip`)}>{t(`${s}.memoryFlush`)}</InfoLabel>
</div>
</ConfigSection>
</div>
</section>
);
}