Skip to content

Commit 4d69554

Browse files
authored
Internationalize the BrowserSessionRow (#1797)
1 parent fbb5cfc commit 4d69554

File tree

16 files changed

+354
-17
lines changed

16 files changed

+354
-17
lines changed

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

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { vscode } from "../../utils/vscode"
1212
import CodeBlock, { CODE_BLOCK_BG_COLOR } from "../common/CodeBlock"
1313
import { ChatRowContent, ProgressIndicator } from "./ChatRow"
1414
import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
15+
import { useTranslation } from "react-i18next"
1516

1617
interface BrowserSessionRowProps {
1718
messages: ClineMessage[]
@@ -25,6 +26,7 @@ interface BrowserSessionRowProps {
2526

2627
const BrowserSessionRow = memo((props: BrowserSessionRowProps) => {
2728
const { messages, isLast, onHeightChange, lastModifiedMessage } = props
29+
const { t } = useTranslation()
2830
const prevHeightRef = useRef(0)
2931
const [maxActionHeight, setMaxActionHeight] = useState(0)
3032
const [consoleLogsExpanded, setConsoleLogsExpanded] = useState(false)
@@ -242,7 +244,7 @@ const BrowserSessionRow = memo((props: BrowserSessionRowProps) => {
242244
style={{ color: "var(--vscode-foreground)", marginBottom: "-1.5px" }}></span>
243245
)}
244246
<span style={{ fontWeight: "bold" }}>
245-
<>Roo wants to use the browser:</>
247+
<>{t("chat:browser.rooWantsToUse")}</>
246248
</span>
247249
</div>
248250
<div
@@ -295,7 +297,7 @@ const BrowserSessionRow = memo((props: BrowserSessionRowProps) => {
295297
{displayState.screenshot ? (
296298
<img
297299
src={displayState.screenshot}
298-
alt="Browser screenshot"
300+
alt={t("chat:browser.screenshot")}
299301
style={{
300302
position: "absolute",
301303
top: 0,
@@ -353,10 +355,12 @@ const BrowserSessionRow = memo((props: BrowserSessionRowProps) => {
353355
padding: `9px 8px ${consoleLogsExpanded ? 0 : 8}px 8px`,
354356
}}>
355357
<span className={`codicon codicon-chevron-${consoleLogsExpanded ? "down" : "right"}`}></span>
356-
<span style={{ fontSize: "0.8em" }}>Console Logs</span>
358+
<span style={{ fontSize: "0.8em" }}>{t("chat:browser.consoleLogs")}</span>
357359
</div>
358360
{consoleLogsExpanded && (
359-
<CodeBlock source={`${"```"}shell\n${displayState.consoleLogs || "(No new logs)"}\n${"```"}`} />
361+
<CodeBlock
362+
source={`${"```"}shell\n${displayState.consoleLogs || t("chat:browser.noNewLogs")}\n${"```"}`}
363+
/>
360364
)}
361365
</div>
362366
</div>
@@ -376,18 +380,18 @@ const BrowserSessionRow = memo((props: BrowserSessionRowProps) => {
376380
borderTop: "1px solid var(--vscode-editorGroup-border)",
377381
}}>
378382
<div>
379-
Step {currentPageIndex + 1} of {pages.length}
383+
{t("chat:browser.navigation.step", { current: currentPageIndex + 1, total: pages.length })}
380384
</div>
381385
<div style={{ display: "flex", gap: "4px" }}>
382386
<VSCodeButton
383387
disabled={currentPageIndex === 0 || isBrowsing}
384388
onClick={() => setCurrentPageIndex((i) => i - 1)}>
385-
Previous
389+
{t("chat:browser.navigation.previous")}
386390
</VSCodeButton>
387391
<VSCodeButton
388392
disabled={currentPageIndex === pages.length - 1 || isBrowsing}
389393
onClick={() => setCurrentPageIndex((i) => i + 1)}>
390-
Next
394+
{t("chat:browser.navigation.next")}
391395
</VSCodeButton>
392396
</div>
393397
</div>
@@ -424,6 +428,7 @@ const BrowserSessionRowContent = ({
424428
setMaxActionHeight,
425429
isStreaming,
426430
}: BrowserSessionRowContentProps) => {
431+
const { t } = useTranslation()
427432
const headerStyle: React.CSSProperties = {
428433
display: "flex",
429434
alignItems: "center",
@@ -474,7 +479,7 @@ const BrowserSessionRowContent = ({
474479
return (
475480
<>
476481
<div style={headerStyle}>
477-
<span style={{ fontWeight: "bold" }}>Browser Session Started</span>
482+
<span style={{ fontWeight: "bold" }}>{t("chat:browser.sessionStarted")}</span>
478483
</div>
479484
<div
480485
style={{
@@ -503,20 +508,21 @@ const BrowserActionBox = ({
503508
coordinate?: string
504509
text?: string
505510
}) => {
511+
const { t } = useTranslation()
506512
const getBrowserActionText = (action: BrowserAction, coordinate?: string, text?: string) => {
507513
switch (action) {
508514
case "launch":
509-
return `Launch browser at ${text}`
515+
return t("chat:browser.actions.launch", { url: text })
510516
case "click":
511-
return `Click (${coordinate?.replace(",", ", ")})`
517+
return t("chat:browser.actions.click", { coordinate: coordinate?.replace(",", ", ") })
512518
case "type":
513-
return `Type "${text}"`
519+
return t("chat:browser.actions.type", { text })
514520
case "scroll_down":
515-
return "Scroll down"
521+
return t("chat:browser.actions.scrollDown")
516522
case "scroll_up":
517-
return "Scroll up"
523+
return t("chat:browser.actions.scrollUp")
518524
case "close":
519-
return "Close browser"
525+
return t("chat:browser.actions.close")
520526
default:
521527
return action
522528
}
@@ -541,7 +547,7 @@ const BrowserActionBox = ({
541547
whiteSpace: "normal",
542548
wordBreak: "break-word",
543549
}}>
544-
<span style={{ fontWeight: 500 }}>Browse Action: </span>
550+
<span style={{ fontWeight: 500 }}>{t("chat:browser.actions.title")}</span>
545551
{getBrowserActionText(action, coordinate, text)}
546552
</span>
547553
</div>
@@ -551,6 +557,7 @@ const BrowserActionBox = ({
551557
}
552558

553559
const BrowserCursor: React.FC<{ style?: React.CSSProperties }> = ({ style }) => {
560+
const { t } = useTranslation()
554561
// (can't use svgs in vsc extensions)
555562
const cursorBase64 =
556563
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAYCAYAAAAVibZIAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAFaADAAQAAAABAAAAGAAAAADwi9a/AAADGElEQVQ4EZ2VbUiTURTH772be/PxZdsz3cZwC4RVaB8SAjMpxQwSWZbQG/TFkN7oW1Df+h6IRV9C+hCpKUSIZUXOfGM5tAKViijFFEyfZ7Ol29S1Pbdzl8Uw9+aBu91zzv3/nt17zt2DEZjBYOAkKrtFMXIghAWM8U2vMN/FctsxGRMpM7NbEEYNMM2CYUSInlJx3OpawO9i+XSNQYkmk2uFb9njzkcfVSr1p/GJiQKMULVaw2WuBv296UKRxWJR6wxGCmM1EAhSNppv33GBH9qI32cPTAtss9lUm6EM3N7R+RbigT+5/CeosFCZKpjEW+iorS1pb30wDUXzQfHqtD/9L3ieZ2ee1OJCmbL8QHnRs+4uj0wmW4QzrpCwvJ8zGg3JqAmhTLynuLiwv8/5KyND8Q3cEkUEDWu15oJE4KRQJt5hs1rcriGNRqP+DK4dyyWXXm/aFQ+cEpSJ8/LyDGPuEZNOmzsOroUSOqzXG/dtBU4ZysTZYKNut91sNo2Cq6cE9enz86s2g9OCMrFSqVC5hgb32u072W3jKMU90Hb1seC0oUwsB+t92bO/rKx0EFGkgFCnjjc1/gVvC8rE0L+4o63t4InjxwbAJQjTe3qD8QrLkXA4DC24fWtuajp06cLFYSBIFKGmXKPRRmAnME9sPt+yLwIWb9WN69fKoTneQz4Dh2mpPNkvfeV0jjecb9wNAkwIEVQq5VJOds4Kb+DXoAsiVquVwI1Dougpij6UyGYx+5cKroeDEFibm5lWRRMbH1+npmYrq6qhwlQHIbajZEf1fElcqGGFpGg9HMuKzpfBjhytCTMgkJ56RX09zy/ysENTBElmjIgJnmNChJqohDVQqpEfwkILE8v/o0GAnV9F1eEvofVQCbiTBEXOIPQh5PGgefDZeAcjrpGZjULBr/m3tZOnz7oEQWRAQZLjWlEU/XEJWySiILgRc5Cz1DkcAyuBFcnpfF0JiXWKpcolQXizhS5hKAqFpr0MVbgbuxJ6+5xX+P4wNpbqPPrugZfbmIbLmgQR3Aw8QSi66hUXulOFbF73GxqjE5BNXWNeAAAAAElFTkSuQmCC"
@@ -563,8 +570,8 @@ const BrowserCursor: React.FC<{ style?: React.CSSProperties }> = ({ style }) =>
563570
height: "22px",
564571
...style,
565572
}}
566-
alt="cursor"
567-
aria-label="cursor"
573+
alt={t("chat:browser.cursor")}
574+
aria-label={t("chat:browser.cursor")}
568575
/>
569576
)
570577
}

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "Selecció de proveïdor OpenRouter",
212212
"hideButton": "Amagar anunci",
213213
"detailsDiscussLinks": "Obté més detalls i participa a <discordLink>Discord</discordLink> i <redditLink>Reddit</redditLink> 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo vol utilitzar el navegador:",
217+
"consoleLogs": "Registres de consola",
218+
"noNewLogs": "(Cap registre nou)",
219+
"screenshot": "Captura de pantalla del navegador",
220+
"cursor": "cursor",
221+
"navigation": {
222+
"step": "Pas {{current}} de {{total}}",
223+
"previous": "Anterior",
224+
"next": "Següent"
225+
},
226+
"sessionStarted": "Sessió de navegador iniciada",
227+
"actions": {
228+
"title": "Acció de navegació: ",
229+
"launch": "Iniciar navegador a {{url}}",
230+
"click": "Clic ({{coordinate}})",
231+
"type": "Escriure \"{{text}}\"",
232+
"scrollDown": "Desplaçar avall",
233+
"scrollUp": "Desplaçar amunt",
234+
"close": "Tancar navegador"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "OpenRouter-Anbieterauswahl",
212212
"hideButton": "Ankündigung ausblenden",
213213
"detailsDiscussLinks": "Erhalte mehr Details und diskutiere auf <discordLink>Discord</discordLink> und <redditLink>Reddit</redditLink> 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo möchte den Browser verwenden:",
217+
"consoleLogs": "Konsolenprotokolle",
218+
"noNewLogs": "(Keine neuen Protokolle)",
219+
"screenshot": "Browser-Screenshot",
220+
"cursor": "Cursor",
221+
"navigation": {
222+
"step": "Schritt {{current}} von {{total}}",
223+
"previous": "Zurück",
224+
"next": "Weiter"
225+
},
226+
"sessionStarted": "Browser-Sitzung gestartet",
227+
"actions": {
228+
"title": "Browser-Aktion: ",
229+
"launch": "Browser starten auf {{url}}",
230+
"click": "Klicken ({{coordinate}})",
231+
"type": "Eingeben \"{{text}}\"",
232+
"scrollDown": "Nach unten scrollen",
233+
"scrollUp": "Nach oben scrollen",
234+
"close": "Browser schließen"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"reasoning": {
212212
"thinking": "Thinking",
213213
"seconds": "{{count}}s"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo wants to use the browser:",
217+
"consoleLogs": "Console Logs",
218+
"noNewLogs": "(No new logs)",
219+
"screenshot": "Browser screenshot",
220+
"cursor": "cursor",
221+
"navigation": {
222+
"step": "Step {{current}} of {{total}}",
223+
"previous": "Previous",
224+
"next": "Next"
225+
},
226+
"sessionStarted": "Browser Session Started",
227+
"actions": {
228+
"title": "Browse Action: ",
229+
"launch": "Launch browser at {{url}}",
230+
"click": "Click ({{coordinate}})",
231+
"type": "Type \"{{text}}\"",
232+
"scrollDown": "Scroll down",
233+
"scrollUp": "Scroll up",
234+
"close": "Close browser"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "Selección de proveedor OpenRouter",
212212
"hideButton": "Ocultar anuncio",
213213
"detailsDiscussLinks": "Obtén más detalles y participa en <discordLink>Discord</discordLink> y <redditLink>Reddit</redditLink> 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo quiere usar el navegador:",
217+
"consoleLogs": "Registros de la consola",
218+
"noNewLogs": "(No hay nuevos registros)",
219+
"screenshot": "Captura de pantalla del navegador",
220+
"cursor": "cursor",
221+
"navigation": {
222+
"step": "Paso {{current}} de {{total}}",
223+
"previous": "Anterior",
224+
"next": "Siguiente"
225+
},
226+
"sessionStarted": "Sesión de navegador iniciada",
227+
"actions": {
228+
"title": "Acción de navegación: ",
229+
"launch": "Iniciar navegador en {{url}}",
230+
"click": "Clic ({{coordinate}})",
231+
"type": "Escribir \"{{text}}\"",
232+
"scrollDown": "Desplazar hacia abajo",
233+
"scrollUp": "Desplazar hacia arriba",
234+
"close": "Cerrar navegador"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "Sélection du fournisseur OpenRouter",
212212
"hideButton": "Masquer l'annonce",
213213
"detailsDiscussLinks": "Obtenez plus de détails et participez aux discussions sur <discordLink>Discord</discordLink> et <redditLink>Reddit</redditLink> 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo veut utiliser le navigateur :",
217+
"consoleLogs": "Journaux de console",
218+
"noNewLogs": "(Pas de nouveaux journaux)",
219+
"screenshot": "Capture d'écran du navigateur",
220+
"cursor": "curseur",
221+
"navigation": {
222+
"step": "Étape {{current}} sur {{total}}",
223+
"previous": "Précédent",
224+
"next": "Suivant"
225+
},
226+
"sessionStarted": "Session de navigateur démarrée",
227+
"actions": {
228+
"title": "Action de navigation : ",
229+
"launch": "Lancer le navigateur sur {{url}}",
230+
"click": "Cliquer ({{coordinate}})",
231+
"type": "Saisir \"{{text}}\"",
232+
"scrollDown": "Défiler vers le bas",
233+
"scrollUp": "Défiler vers le haut",
234+
"close": "Fermer le navigateur"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/hi/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "OpenRouter प्रदाता चयन",
212212
"hideButton": "घोषणा छिपाएँ",
213213
"detailsDiscussLinks": "<discordLink>Discord</discordLink> और <redditLink>Reddit</redditLink> पर अधिक जानकारी प्राप्त करें और चर्चा में भाग लें 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo ब्राउज़र का उपयोग करना चाहता है:",
217+
"consoleLogs": "कंसोल लॉग",
218+
"noNewLogs": "(कोई नया लॉग नहीं)",
219+
"screenshot": "ब्राउज़र स्क्रीनशॉट",
220+
"cursor": "कर्सर",
221+
"navigation": {
222+
"step": "चरण {{current}} / {{total}}",
223+
"previous": "पिछला",
224+
"next": "अगला"
225+
},
226+
"sessionStarted": "ब्राउज़र सत्र शुरू हुआ",
227+
"actions": {
228+
"title": "ब्राउज़र क्रिया: ",
229+
"launch": "{{url}} पर ब्राउज़र लॉन्च करें",
230+
"click": "क्लिक करें ({{coordinate}})",
231+
"type": "टाइप करें \"{{text}}\"",
232+
"scrollDown": "नीचे स्क्रॉल करें",
233+
"scrollUp": "ऊपर स्क्रॉल करें",
234+
"close": "ब्राउज़र बंद करें"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/it/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "Selezione provider OpenRouter",
212212
"hideButton": "Nascondi annuncio",
213213
"detailsDiscussLinks": "Ottieni maggiori dettagli e partecipa alle discussioni su <discordLink>Discord</discordLink> e <redditLink>Reddit</redditLink> 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo vuole utilizzare il browser:",
217+
"consoleLogs": "Log della console",
218+
"noNewLogs": "(Nessun nuovo log)",
219+
"screenshot": "Screenshot del browser",
220+
"cursor": "cursore",
221+
"navigation": {
222+
"step": "Passo {{current}} di {{total}}",
223+
"previous": "Precedente",
224+
"next": "Successivo"
225+
},
226+
"sessionStarted": "Sessione browser avviata",
227+
"actions": {
228+
"title": "Azione browser: ",
229+
"launch": "Avvia browser su {{url}}",
230+
"click": "Clic ({{coordinate}})",
231+
"type": "Digita \"{{text}}\"",
232+
"scrollDown": "Scorri verso il basso",
233+
"scrollUp": "Scorri verso l'alto",
234+
"close": "Chiudi browser"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/ja/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "OpenRouterプロバイダーの選択",
212212
"hideButton": "通知を非表示",
213213
"detailsDiscussLinks": "詳細は<discordLink>Discord</discordLink>と<redditLink>Reddit</redditLink>でご確認・ディスカッションください 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Rooはブラウザを使用したい:",
217+
"consoleLogs": "コンソールログ",
218+
"noNewLogs": "(新しいログはありません)",
219+
"screenshot": "ブラウザのスクリーンショット",
220+
"cursor": "カーソル",
221+
"navigation": {
222+
"step": "ステップ {{current}} / {{total}}",
223+
"previous": "前へ",
224+
"next": "次へ"
225+
},
226+
"sessionStarted": "ブラウザセッション開始",
227+
"actions": {
228+
"title": "ブラウザアクション: ",
229+
"launch": "{{url}} でブラウザを起動",
230+
"click": "クリック ({{coordinate}})",
231+
"type": "入力 \"{{text}}\"",
232+
"scrollDown": "下にスクロール",
233+
"scrollUp": "上にスクロール",
234+
"close": "ブラウザを閉じる"
235+
}
214236
}
215237
}

webview-ui/src/i18n/locales/ko/chat.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,27 @@
211211
"feature5": "OpenRouter 제공자 선택",
212212
"hideButton": "공지 숨기기",
213213
"detailsDiscussLinks": "<discordLink>Discord</discordLink>와 <redditLink>Reddit</redditLink>에서 더 자세한 정보를 확인하고 논의하세요 🚀"
214+
},
215+
"browser": {
216+
"rooWantsToUse": "Roo가 브라우저를 사용하고 싶어합니다:",
217+
"consoleLogs": "콘솔 로그",
218+
"noNewLogs": "(새 로그 없음)",
219+
"screenshot": "브라우저 스크린샷",
220+
"cursor": "커서",
221+
"navigation": {
222+
"step": "단계 {{current}} / {{total}}",
223+
"previous": "이전",
224+
"next": "다음"
225+
},
226+
"sessionStarted": "브라우저 세션 시작됨",
227+
"actions": {
228+
"title": "브라우저 작업: ",
229+
"launch": "{{url}}에서 브라우저 실행",
230+
"click": "클릭 ({{coordinate}})",
231+
"type": "입력 \"{{text}}\"",
232+
"scrollDown": "아래로 스크롤",
233+
"scrollUp": "위로 스크롤",
234+
"close": "브라우저 닫기"
235+
}
214236
}
215237
}

0 commit comments

Comments
 (0)