Skip to content

Commit dea3db7

Browse files
authored
Merge pull request #1676 from feifei325/i18n/chatview_buttron
refactor(i18n): Internationalization of Button and tooltip in ChatView
2 parents 1f5f668 + 66c6dbb commit dea3db7

40 files changed

+1349
-64
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 51 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -119,16 +119,16 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
119119
setTextAreaDisabled(true)
120120
setClineAsk("api_req_failed")
121121
setEnableButtons(true)
122-
setPrimaryButtonText("Retry")
123-
setSecondaryButtonText("Start New Task")
122+
setPrimaryButtonText(t("chat:retry.title"))
123+
setSecondaryButtonText(t("chat:startNewTask.title"))
124124
break
125125
case "mistake_limit_reached":
126126
playSound("progress_loop")
127127
setTextAreaDisabled(false)
128128
setClineAsk("mistake_limit_reached")
129129
setEnableButtons(true)
130-
setPrimaryButtonText("Proceed Anyways")
131-
setSecondaryButtonText("Start New Task")
130+
setPrimaryButtonText(t("chat:proceedAnyways.title"))
131+
setSecondaryButtonText(t("chat:startNewTask.title"))
132132
break
133133
case "followup":
134134
setTextAreaDisabled(isPartial)
@@ -149,16 +149,16 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
149149
case "editedExistingFile":
150150
case "appliedDiff":
151151
case "newFileCreated":
152-
setPrimaryButtonText("Save")
153-
setSecondaryButtonText("Reject")
152+
setPrimaryButtonText(t("chat:save.title"))
153+
setSecondaryButtonText(t("chat:reject.title"))
154154
break
155155
case "finishTask":
156-
setPrimaryButtonText("Complete Subtask and Return")
156+
setPrimaryButtonText(t("chat:completeSubtaskAndReturn.title"))
157157
setSecondaryButtonText(undefined)
158158
break
159159
default:
160-
setPrimaryButtonText("Approve")
161-
setSecondaryButtonText("Reject")
160+
setPrimaryButtonText(t("chat:approve.title"))
161+
setSecondaryButtonText(t("chat:reject.title"))
162162
break
163163
}
164164
break
@@ -169,8 +169,8 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
169169
setTextAreaDisabled(isPartial)
170170
setClineAsk("browser_action_launch")
171171
setEnableButtons(!isPartial)
172-
setPrimaryButtonText("Approve")
173-
setSecondaryButtonText("Reject")
172+
setPrimaryButtonText(t("chat:approve.title"))
173+
setSecondaryButtonText(t("chat:reject.title"))
174174
break
175175
case "command":
176176
if (!isAutoApproved(lastMessage)) {
@@ -179,45 +179,45 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
179179
setTextAreaDisabled(isPartial)
180180
setClineAsk("command")
181181
setEnableButtons(!isPartial)
182-
setPrimaryButtonText("Run Command")
183-
setSecondaryButtonText("Reject")
182+
setPrimaryButtonText(t("chat:runCommand.title"))
183+
setSecondaryButtonText(t("chat:reject.title"))
184184
break
185185
case "command_output":
186186
setTextAreaDisabled(false)
187187
setClineAsk("command_output")
188188
setEnableButtons(true)
189-
setPrimaryButtonText("Proceed While Running")
189+
setPrimaryButtonText(t("chat:proceedWhileRunning.title"))
190190
setSecondaryButtonText(undefined)
191191
break
192192
case "use_mcp_server":
193193
setTextAreaDisabled(isPartial)
194194
setClineAsk("use_mcp_server")
195195
setEnableButtons(!isPartial)
196-
setPrimaryButtonText("Approve")
197-
setSecondaryButtonText("Reject")
196+
setPrimaryButtonText(t("chat:approve.title"))
197+
setSecondaryButtonText(t("chat:reject.title"))
198198
break
199199
case "completion_result":
200200
// extension waiting for feedback. but we can just present a new task button
201201
playSound("celebration")
202202
setTextAreaDisabled(isPartial)
203203
setClineAsk("completion_result")
204204
setEnableButtons(!isPartial)
205-
setPrimaryButtonText("Start New Task")
205+
setPrimaryButtonText(t("chat:startNewTask.title"))
206206
setSecondaryButtonText(undefined)
207207
break
208208
case "resume_task":
209209
setTextAreaDisabled(false)
210210
setClineAsk("resume_task")
211211
setEnableButtons(true)
212-
setPrimaryButtonText("Resume Task")
213-
setSecondaryButtonText("Terminate")
212+
setPrimaryButtonText(t("chat:resumeTask.title"))
213+
setSecondaryButtonText(t("chat:terminate.title"))
214214
setDidClickCancel(false) // special case where we reset the cancel button state
215215
break
216216
case "resume_completed_task":
217217
setTextAreaDisabled(false)
218218
setClineAsk("resume_completed_task")
219219
setEnableButtons(true)
220-
setPrimaryButtonText("Start New Task")
220+
setPrimaryButtonText(t("chat:startNewTask.title"))
221221
setSecondaryButtonText(undefined)
222222
setDidClickCancel(false)
223223
break
@@ -942,11 +942,11 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
942942
)
943943

944944
const placeholderText = useMemo(() => {
945-
const baseText = task ? "Type a message..." : "Type your task here..."
946-
const contextText = "(@ to add context, / to switch modes"
947-
const imageText = shouldDisableImages ? ", hold shift to drag in files" : ", hold shift to drag in files/images"
945+
const baseText = task ? t("chat:typeMessage") : t("chat:typeTask")
946+
const contextText = t("chat:addContext")
947+
const imageText = shouldDisableImages ? `, ${t("chat:dragFiles")}` : `, ${t("chat:dragFilesImages")}`
948948
return baseText + `\n${contextText}${imageText})`
949-
}, [task, shouldDisableImages])
949+
}, [task, shouldDisableImages, t])
950950

951951
const itemContent = useCallback(
952952
(index: number, messageOrGroup: ClineMessage | ClineMessage[]) => {
@@ -1107,13 +1107,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
11071107
{showAnnouncement && <Announcement version={version} hideAnnouncement={hideAnnouncement} />}
11081108
<div style={{ padding: "0 20px", flexShrink: 0 }}>
11091109
<h2>{t("chat:greeting")}</h2>
1110-
<p>
1111-
Thanks to the latest breakthroughs in agentic coding capabilities, I can handle complex
1112-
software development tasks step-by-step. With tools that let me create & edit files, explore
1113-
complex projects, use the browser, and execute terminal commands (after you grant
1114-
permission), I can assist you in ways that go beyond code completion or tech support. I can
1115-
even use MCP to create new tools and extend my own capabilities.
1116-
</p>
1110+
<p>{t("chat:aboutMe")}</p>
11171111
</div>
11181112
{taskHistory.length > 0 && <HistoryPreview showHistoryView={showHistoryView} />}
11191113
</div>
@@ -1185,7 +1179,7 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
11851179
scrollToBottomSmooth()
11861180
disableAutoScrollRef.current = false
11871181
}}
1188-
title="Scroll to bottom of chat">
1182+
title={t("chat:scrollToBottom")}>
11891183
<span className="codicon codicon-chevron-down" style={{ fontSize: "18px" }}></span>
11901184
</ScrollToBottomButton>
11911185
</div>
@@ -1210,22 +1204,23 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
12101204
marginRight: secondaryButtonText ? "6px" : "0",
12111205
}}
12121206
title={
1213-
primaryButtonText === "Retry"
1214-
? "Try the operation again"
1215-
: primaryButtonText === "Save"
1216-
? "Save the file changes"
1217-
: primaryButtonText === "Approve"
1218-
? "Approve this action"
1219-
: primaryButtonText === "Run Command"
1220-
? "Execute this command"
1221-
: primaryButtonText === "Start New Task"
1222-
? "Begin a new task"
1223-
: primaryButtonText === "Resume Task"
1224-
? "Continue the current task"
1225-
: primaryButtonText === "Proceed Anyways"
1226-
? "Continue despite warnings"
1227-
: primaryButtonText === "Proceed While Running"
1228-
? "Continue while command executes"
1207+
primaryButtonText === t("chat:retry.title")
1208+
? t("chat:retry.tooltip")
1209+
: primaryButtonText === t("chat:save.title")
1210+
? t("chat:save.tooltip")
1211+
: primaryButtonText === t("chat:approve.title")
1212+
? t("chat:approve.tooltip")
1213+
: primaryButtonText === t("chat:runCommand.title")
1214+
? t("chat:runCommand.tooltip")
1215+
: primaryButtonText === t("chat:startNewTask.title")
1216+
? t("chat:startNewTask.tooltip")
1217+
: primaryButtonText === t("chat:resumeTask.title")
1218+
? t("chat:resumeTask.tooltip")
1219+
: primaryButtonText === t("chat:proceedAnyways.title")
1220+
? t("chat:proceedAnyways.tooltip")
1221+
: primaryButtonText ===
1222+
t("chat:proceedWhileRunning.title")
1223+
? t("chat:proceedWhileRunning.tooltip")
12291224
: undefined
12301225
}
12311226
onClick={(e) => handlePrimaryButtonClick(inputValue, selectedImages)}>
@@ -1242,17 +1237,17 @@ const ChatView = ({ isHidden, showAnnouncement, hideAnnouncement, showHistoryVie
12421237
}}
12431238
title={
12441239
isStreaming
1245-
? "Cancel the current operation"
1246-
: secondaryButtonText === "Start New Task"
1247-
? "Begin a new task"
1248-
: secondaryButtonText === "Reject"
1249-
? "Reject this action"
1250-
: secondaryButtonText === "Terminate"
1251-
? "End the current task"
1240+
? t("chat:cancel.tooltip")
1241+
: secondaryButtonText === t("chat:startNewTask.title")
1242+
? t("chat:startNewTask.tooltip")
1243+
: secondaryButtonText === t("chat:reject.title")
1244+
? t("chat:reject.tooltip")
1245+
: secondaryButtonText === t("chat:terminate.title")
1246+
? t("chat:terminate.tooltip")
12521247
: undefined
12531248
}
12541249
onClick={(e) => handleSecondaryButtonClick(inputValue, selectedImages)}>
1255-
{isStreaming ? "Cancel" : secondaryButtonText}
1250+
{isStreaming ? t("chat:cancel.title") : secondaryButtonText}
12561251
</VSCodeButton>
12571252
)}
12581253
</div>

webview-ui/src/components/common/TelemetryBanner.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { memo, useState } from "react"
33
import styled from "styled-components"
44
import { vscode } from "../../utils/vscode"
55
import { TelemetrySetting } from "../../../../src/shared/TelemetrySetting"
6+
import { useAppTranslation } from "../../i18n/TranslationContext"
67

78
const BannerContainer = styled.div`
89
background-color: var(--vscode-banner-background);
@@ -24,6 +25,7 @@ const ButtonContainer = styled.div`
2425
`
2526

2627
const TelemetryBanner = () => {
28+
const { t } = useAppTranslation()
2729
const [hasChosen, setHasChosen] = useState(false)
2830

2931
const handleAllow = () => {
@@ -43,25 +45,24 @@ const TelemetryBanner = () => {
4345
return (
4446
<BannerContainer>
4547
<div>
46-
<strong>Help Improve Roo Code</strong>
48+
<strong>{t("common:telemetryTitle")}</strong>
4749
<div className="mt-1">
48-
Send anonymous error and usage data to help us fix bugs and improve the extension. No code, prompts,
49-
or personal information is ever sent.
50+
{t("common:anonymousTelemetry")}
5051
<div className="mt-1">
51-
You can always change this at the bottom of the{" "}
52+
{t("common:changeSettings")}{" "}
5253
<VSCodeLink href="#" onClick={handleOpenSettings}>
53-
settings
54+
{t("common:settings")}
5455
</VSCodeLink>
5556
.
5657
</div>
5758
</div>
5859
</div>
5960
<ButtonContainer>
6061
<VSCodeButton appearance="primary" onClick={handleAllow} disabled={hasChosen}>
61-
Allow
62+
{t("common:allow")}
6263
</VSCodeButton>
6364
<VSCodeButton appearance="secondary" onClick={handleDeny} disabled={hasChosen}>
64-
Deny
65+
{t("common:deny")}
6566
</VSCodeButton>
6667
</ButtonContainer>
6768
</BannerContainer>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"greeting": "ماذا يمكن أن يفعل Roo من أجلك؟",
3+
"retry": {
4+
"title": "إعادة المحاولة",
5+
"tooltip": "حاول العملية مرة أخرى"
6+
},
7+
"startNewTask": {
8+
"title": "بدء مهمة جديدة",
9+
"tooltip": "ابدأ مهمة جديدة"
10+
},
11+
"proceedAnyways": {
12+
"title": "المتابعة على أي حال",
13+
"tooltip": "استمر أثناء تنفيذ الأمر"
14+
},
15+
"save": {
16+
"title": "حفظ",
17+
"tooltip": "حفظ تغييرات الملف"
18+
},
19+
"reject": {
20+
"title": "رفض",
21+
"tooltip": "رفض هذا الإجراء"
22+
},
23+
"completeSubtaskAndReturn": "إكمال المهمة الفرعية والعودة",
24+
"approve": {
25+
"title": "موافقة",
26+
"tooltip": "الموافقة على هذا الإجراء"
27+
},
28+
"runCommand": {
29+
"title": "تنفيذ الأمر",
30+
"tooltip": "تنفيذ هذا الأمر"
31+
},
32+
"proceedWhileRunning": {
33+
"title": "المتابعة أثناء التشغيل",
34+
"tooltip": "استمر على الرغم من التحذيرات"
35+
},
36+
"resumeTask": {
37+
"title": "استئناف المهمة",
38+
"tooltip": "استئناف المهمة الحالية"
39+
},
40+
"terminate": {
41+
"title": "إنهاء",
42+
"tooltip": "إنهاء المهمة الحالية"
43+
},
44+
"cancel": {
45+
"title": "إلغاء",
46+
"tooltip": "إلغاء العملية الحالية"
47+
},
48+
"scrollToBottom": "التمرير إلى أسفل الدردشة",
49+
"aboutMe": "بفضل أحدث التطورات في قدرات الترميز الذكية، يمكنني التعامل مع مهام تطوير البرمجيات المعقدة خطوة بخطوة. باستخدام الأدوات التي تتيح لي إنشاء وتحرير الملفات، واستكشاف المشاريع المعقدة، واستخدام المتصفح، وتنفيذ أوامر الطرفية (بعد منحك الإذن)، يمكنني مساعدتك بطرق تتجاوز إكمال التعليمات البرمجية أو الدعم الفني. يمكنني حتى استخدام MCP لإنشاء أدوات جديدة وتوسيع قدراتي الخاصة.",
50+
"selectMode": "اختر وضع التفاعل",
51+
"selectApiConfig": "اختر تكوين API",
52+
"enhancePrompt": "تحسين المطالبة بسياق إضافي",
53+
"addImages": "إضافة صور إلى الرسالة",
54+
"sendMessage": "إرسال الرسالة",
55+
"typeMessage": "اكتب رسالة...",
56+
"typeTask": "اكتب مهمتك هنا...",
57+
"addContext": "(@ لإضافة سياق، / لتبديل الأوضاع",
58+
"dragFiles": "اضغط على shift لسحب الملفات",
59+
"dragFilesImages": "اضغط على shift لسحب الملفات/الصور"
60+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"title": "ساعد في تحسين Roo Code",
3+
"anonymousTelemetry": "إرسال بيانات الاستخدام والأخطاء المجهولة للمساعدة في إصلاح الأخطاء وتحسين الامتداد. لا يتم إرسال أي كود أو نصوص أو معلومات شخصية.",
4+
"changeSettings": "يمكنك دائمًا تغيير هذا في أسفل الإعدادات",
5+
"settings": "الإعدادات",
6+
"allow": "السماح",
7+
"deny": "رفض"
8+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"greeting": "Què pot fer Roo per tu?",
3+
"retry": {
4+
"title": "Tornar a intentar",
5+
"tooltip": "Torna a provar l'operació"
6+
},
7+
"startNewTask": {
8+
"title": "Començar una nova tasca",
9+
"tooltip": "Comença una nova tasca"
10+
},
11+
"proceedAnyways": {
12+
"title": "Continuar de totes maneres",
13+
"tooltip": "Continua mentre s'executa l'ordre"
14+
},
15+
"save": {
16+
"title": "Desar",
17+
"tooltip": "Desa els canvis del fitxer"
18+
},
19+
"reject": {
20+
"title": "Rebutjar",
21+
"tooltip": "Rebutja aquesta acció"
22+
},
23+
"completeSubtaskAndReturn": "Completar la subtasca i tornar",
24+
"approve": {
25+
"title": "Aprovar",
26+
"tooltip": "Aprova aquesta acció"
27+
},
28+
"runCommand": {
29+
"title": "Executar ordre",
30+
"tooltip": "Executa aquesta ordre"
31+
},
32+
"proceedWhileRunning": {
33+
"title": "Continuar mentre s'executa",
34+
"tooltip": "Continua malgrat els advertiments"
35+
},
36+
"resumeTask": {
37+
"title": "Reprendre la tasca",
38+
"tooltip": "Repren la tasca actual"
39+
},
40+
"terminate": {
41+
"title": "Finalitzar",
42+
"tooltip": "Finalitza la tasca actual"
43+
},
44+
"cancel": {
45+
"title": "Cancel·lar",
46+
"tooltip": "Cancel·la l'operació actual"
47+
},
48+
"scrollToBottom": "Desplaça't al final del xat",
49+
"aboutMe": "Gràcies als últims avenços en capacitats de codificació intel·ligent, puc gestionar tasques complexes de desenvolupament de programari pas a pas. Amb eines que em permeten crear i editar fitxers, explorar projectes complexos, utilitzar el navegador i executar ordres de terminal (després que em donis permís), puc ajudar-te de maneres que van més enllà de la finalització de codi o el suport tècnic. Fins i tot puc utilitzar MCP per crear noves eines i ampliar les meves capacitats.",
50+
"selectMode": "Selecciona el mode d'interacció",
51+
"selectApiConfig": "Selecciona la configuració de l'API",
52+
"enhancePrompt": "Millora la sol·licitud amb context addicional",
53+
"addImages": "Afegeix imatges al missatge",
54+
"sendMessage": "Envia el missatge",
55+
"typeMessage": "Escriu un missatge...",
56+
"typeTask": "Escriu la teva tasca aquí...",
57+
"addContext": "(@ per afegir context, / per canviar de mode",
58+
"dragFiles": "manté premut shift per arrossegar fitxers",
59+
"dragFilesImages": "manté premut shift per arrossegar fitxers/imatges"
60+
}

0 commit comments

Comments
 (0)