Skip to content

Commit c1d68a2

Browse files
committed
feat(i8n): Add multilingual support for manual relay dialog text
1 parent a1a2380 commit c1d68a2

File tree

21 files changed

+619
-30
lines changed

21 files changed

+619
-30
lines changed

webview-ui/src/components/human-relay/HumanRelayDialog.tsx

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useClipboard } from "../ui/hooks"
77
import { AlertTriangle, Check, Copy, Power, X } from "lucide-react"
88
import { useState as useReactState } from "react"
99
import { vscode } from "../../utils/vscode"
10+
import { useAppTranslation } from "@/i18n/TranslationContext"
1011

1112
interface HumanRelayDialogProps {
1213
isOpen: boolean
@@ -35,6 +36,7 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
3536
monitorInterval = 500,
3637
onToggleMonitor,
3738
}) => {
39+
const { t } = useAppTranslation()
3840
const [response, setResponse] = React.useState("")
3941
const { copy } = useClipboard()
4042
const [isCopyClicked, setIsCopyClicked] = React.useState(false)
@@ -78,14 +80,9 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
7880
}
7981
// Handle duplicate response warning
8082
else if (message.type === "showHumanRelayResponseAlert") {
81-
if (message.requestId === "lastInteraction")
82-
setWarningMessage(
83-
"It seems you copied the AI's response from the last interaction instead of the current task. Please check your interaction with the web AI.",
84-
)
83+
if (message.requestId === "lastInteraction") setWarningMessage(t("humanRelay:warning.lastInteraction"))
8584
else if (message.requestId === "invalidResponse")
86-
setWarningMessage(
87-
"The AI's response does not seem to meet the RooCode format requirements. Please check your interaction with the web AI.",
88-
)
85+
setWarningMessage(t("humanRelay:warning.invalidResponse"))
8986
setShowDuplicateWarning(true)
9087
}
9188
}
@@ -95,7 +92,7 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
9592
return () => {
9693
window.removeEventListener("message", messageHandler)
9794
}
98-
}, [onClose])
95+
}, [onClose, t])
9996

10097
// Copy to clipboard and show success message
10198
const handleCopy = () => {
@@ -125,10 +122,8 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
125122
<Dialog open={isOpen} onOpenChange={(open) => !open && handleCancel()}>
126123
<DialogContent className="sm:max-w-[600px]">
127124
<DialogHeader>
128-
<DialogTitle>Human Relay - Please Help Copy and Paste Information</DialogTitle>
129-
<DialogDescription>
130-
Please copy the text below to the web AI, then paste the AI's response into the input box below.
131-
</DialogDescription>
125+
<DialogTitle>{t("humanRelay:dialogTitle")}</DialogTitle>
126+
<DialogDescription>{t("humanRelay:dialogDescription")}</DialogDescription>
132127
</DialogHeader>
133128

134129
<div className="grid gap-4 py-4">
@@ -143,7 +138,9 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
143138
</Button>
144139
</div>
145140

146-
{isCopyClicked && <div className="text-sm text-emerald-500 font-medium">Copied to clipboard</div>}
141+
{isCopyClicked && (
142+
<div className="text-sm text-emerald-500 font-medium">{t("humanRelay:copiedToClipboard")}</div>
143+
)}
147144
{showDuplicateWarning && (
148145
<div className="flex items-center gap-2 text-sm p-2 rounded-md bg-amber-100 dark:bg-amber-900 border border-amber-300 dark:border-amber-700 text-amber-800 dark:text-amber-300">
149146
<AlertTriangle className="h-4 w-4 text-amber-500" />
@@ -154,27 +151,33 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
154151
<div className="flex items-center justify-between text-sm text-vscode-descriptionForeground">
155152
<div className="flex items-center gap-2">
156153
{isMonitoring && <ProgressIndicator />}
157-
<span>Clipboard Monitoring: {isMonitoring ? "Enabled" : "Disabled"}</span>
154+
<span>
155+
{t("humanRelay:clipboardMonitoring.label")}{" "}
156+
{isMonitoring
157+
? t("humanRelay:clipboardMonitoring.enabled")
158+
: t("humanRelay:clipboardMonitoring.disabled")}
159+
</span>
158160
</div>
159161
<Button
160162
size="sm"
161163
variant={isMonitoring ? "outline" : "default"}
162164
onClick={handleToggleMonitor}
163165
className="gap-1 ml-2">
164166
<Power className="h-4 w-4" />
165-
{isMonitoring ? "Disable" : "Enable"}
167+
{isMonitoring
168+
? t("humanRelay:clipboardMonitoring.disable")
169+
: t("humanRelay:clipboardMonitoring.enable")}
166170
</Button>
167171
</div>
168172

169173
<div className="text-sm text-vscode-descriptionForeground mt-2">
170-
You can use the shortcut Ctrl/Cmd+Alt+V (default) to send the clipboard content. You can also
171-
search for `Send Clipboard` in the shortcut settings to modify the hotkey.
174+
{t("humanRelay:shortcutDescription")}
172175
</div>
173176

174177
<div>
175-
<div className="mb-2 font-medium">Please enter the AI's response:</div>
178+
<div className="mb-2 font-medium">{t("humanRelay:aiResponse.label")}</div>
176179
<Textarea
177-
placeholder="Paste the AI's response here..."
180+
placeholder={t("humanRelay:aiResponse.placeholder")}
178181
value={response}
179182
onChange={(e) => setResponse(e.target.value)}
180183
className="min-h-[150px]"
@@ -185,11 +188,11 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
185188
<DialogFooter>
186189
<Button variant="outline" onClick={handleCancel} className="gap-1">
187190
<X className="h-4 w-4" />
188-
Cancel
191+
{t("humanRelay:actions.cancel")}
189192
</Button>
190193
<Button onClick={handleSubmit} disabled={!response.trim()} className="gap-1">
191194
<Check className="h-4 w-4" />
192-
Submit
195+
{t("humanRelay:actions.submit")}
193196
</Button>
194197
</DialogFooter>
195198
</DialogContent>

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,16 +1333,11 @@ const ApiOptions = ({
13331333
{selectedProvider === "human-relay" && (
13341334
<>
13351335
<div className="text-sm text-vscode-descriptionForeground">
1336-
No API key is required, but the user needs to help copy and paste the information to the web
1337-
chat AI.
1338-
</div>
1339-
<div className="text-sm text-vscode-descriptionForeground">
1340-
During use, a dialog box will pop up and the current message will be copied to the clipboard
1341-
automatically. You need to paste these to web versions of AI (such as ChatGPT or Claude), then
1342-
copy the AI's reply back to the dialog box and click the confirm button.
1336+
{t("humanRelay:settings.description")}
13431337
</div>
1338+
<div className="text-sm text-vscode-descriptionForeground">{t("humanRelay:settings.usage")}</div>
13441339
<div className="mt-4">
1345-
<div className="font-medium">Clipboard monitoring interval (ms)</div>
1340+
<div className="font-medium">{t("humanRelay:settings.monitorInterval")}</div>
13461341
<div className="mt-2">
13471342
<input
13481343
type="range"
@@ -1357,7 +1352,9 @@ const ApiOptions = ({
13571352
className="h-2 focus:outline-0 w-4/5 accent-vscode-button-background"
13581353
/>
13591354
<span style={{ minWidth: "45px", textAlign: "left" }}>
1360-
{apiConfiguration?.humanRelayMonitorInterval || 500} ms
1355+
{t("humanRelay:settings.intervalValue", {
1356+
value: apiConfiguration?.humanRelayMonitorInterval || 500,
1357+
})}
13611358
</span>
13621359
</div>
13631360
</div>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"dialogTitle": "الوسيط البشري - يرجى المساعدة في نسخ ولصق المعلومات",
3+
"dialogDescription": "يرجى نسخ النص التالي إلى الذكاء الاصطناعي على الويب، ثم لصق رد الذكاء الاصطناعي في مربع النص أدناه.",
4+
"copiedToClipboard": "تم النسخ إلى الحافظة",
5+
"warning": {
6+
"lastInteraction": "يبدو أنك نسخت رد الذكاء الاصطناعي من التفاعل الأخير، وليس الرد للمهمة الحالية. يرجى التحقق من تفاعلك مع الذكاء الاصطناعي على الويب.",
7+
"invalidResponse": "يبدو أن رد الذكاء الاصطناعي لا يلبي متطلبات تنسيق RooCode. يرجى التحقق من تفاعلك مع الذكاء الاصطناعي على الويب."
8+
},
9+
"clipboardMonitoring": {
10+
"label": "مراقبة الحافظة:",
11+
"enabled": "مفعّل",
12+
"disabled": "معطّل",
13+
"disable": "تعطيل",
14+
"enable": "تفعيل"
15+
},
16+
"shortcutDescription": "يمكنك استخدام الاختصار Ctrl/Cmd+Alt+V (الافتراضي) لإرسال محتوى الحافظة بسرعة. يمكنك أيضًا تغيير الاختصار عن طريق البحث عن 'إرسال الحافظة' في إعدادات اختصارات لوحة المفاتيح.",
17+
"aiResponse": {
18+
"label": "أدخل رد الذكاء الاصطناعي:",
19+
"placeholder": "الصق رد الذكاء الاصطناعي هنا..."
20+
},
21+
"actions": {
22+
"cancel": "إلغاء",
23+
"submit": "إرسال"
24+
},
25+
"settings": {
26+
"description": "لا يلزم مفتاح API، ولكن يحتاج المستخدمون إلى المساعدة في نسخ ولصق المعلومات إلى دردشة الذكاء الاصطناعي على الويب.",
27+
"usage": "عند الاستخدام، سيظهر مربع حوار وسيتم نسخ الرسالة الحالية تلقائيًا إلى الحافظة. تحتاج إلى لصق هذا المحتوى في الذكاء الاصطناعي على الويب (مثل ChatGPT أو Claude)، ثم نسخ رد الذكاء الاصطناعي مرة أخرى إلى مربع الحوار والنقر على زر التأكيد.",
28+
"monitorInterval": "فترة مراقبة الحافظة (بالمللي ثانية)",
29+
"intervalValue": "{{value}} مللي ثانية"
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"dialogTitle": "Relé Humà - Si us plau, ajudeu a copiar i enganxar informació",
3+
"dialogDescription": "Si us plau, copieu el següent prompt a la IA web i després enganxeu la resposta de la IA al quadre de text de sota.",
4+
"copiedToClipboard": "Copiat al porta-retalls",
5+
"warning": {
6+
"lastInteraction": "Sembla que heu copiat la resposta de la IA de l'última interacció, no la resposta per a la tasca actual. Si us plau, comproveu la vostra interacció amb la IA web.",
7+
"invalidResponse": "La resposta de la IA no sembla complir els requisits de format de RooCode. Si us plau, comproveu la vostra interacció amb la IA web."
8+
},
9+
"clipboardMonitoring": {
10+
"label": "Monitoratge del porta-retalls:",
11+
"enabled": "Activat",
12+
"disabled": "Desactivat",
13+
"disable": "Desactivar",
14+
"enable": "Activar"
15+
},
16+
"shortcutDescription": "Podeu utilitzar la drecera Ctrl/Cmd+Alt+V (per defecte) per enviar ràpidament el contingut del porta-retalls. També podeu canviar la drecera cercant 'enviar porta-retalls' a la configuració de dreceres de teclat.",
17+
"aiResponse": {
18+
"label": "Introduïu la resposta de la IA:",
19+
"placeholder": "Enganxeu aquí la resposta de la IA..."
20+
},
21+
"actions": {
22+
"cancel": "Cancel·lar",
23+
"submit": "Enviar"
24+
},
25+
"settings": {
26+
"description": "No es requereix clau API, però els usuaris han d'ajudar a copiar i enganxar informació al xat d'IA basat en web.",
27+
"usage": "En utilitzar-lo, apareixerà un diàleg i el missatge actual es copiarà automàticament al porta-retalls. Heu d'enganxar aquest contingut a la IA basada en web (com ChatGPT o Claude), després copiar la resposta de la IA de tornada al diàleg i fer clic al botó de confirmació.",
28+
"monitorInterval": "Interval de monitoratge del porta-retalls (mil·lisegons)",
29+
"intervalValue": "{{value}} mil·lisegons"
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"dialogTitle": "Lidský přenos - Prosím, pomozte zkopírovat a vložit informace",
3+
"dialogDescription": "Prosím, zkopírujte následující výzvu do webové AI a poté vložte odpověď AI do textového pole níže.",
4+
"copiedToClipboard": "Zkopírováno do schránky",
5+
"warning": {
6+
"lastInteraction": "Zdá se, že jste zkopírovali odpověď AI z poslední interakce, ne odpověď pro aktuální úkol. Prosím, zkontrolujte vaši interakci s webovou AI.",
7+
"invalidResponse": "Odpověď AI zřejmě nesplňuje požadavky formátu RooCode. Prosím, zkontrolujte vaši interakci s webovou AI."
8+
},
9+
"clipboardMonitoring": {
10+
"label": "Monitorování schránky:",
11+
"enabled": "Povoleno",
12+
"disabled": "Zakázáno",
13+
"disable": "Zakázat",
14+
"enable": "Povolit"
15+
},
16+
"shortcutDescription": "Můžete použít klávesovou zkratku Ctrl/Cmd+Alt+V (výchozí) pro rychlé odeslání obsahu schránky. Zkratku můžete také změnit vyhledáním 'odeslat schránku' v nastavení klávesových zkratek.",
17+
"aiResponse": {
18+
"label": "Zadejte odpověď AI:",
19+
"placeholder": "Sem vložte odpověď AI..."
20+
},
21+
"actions": {
22+
"cancel": "Zrušit",
23+
"submit": "Odeslat"
24+
},
25+
"settings": {
26+
"description": "API klíč není vyžadován, ale uživatelé musí pomoci zkopírovat a vložit informace do webového AI chatu.",
27+
"usage": "Při použití se objeví dialogové okno a aktuální zpráva bude automaticky zkopírována do schránky. Musíte vložit tento obsah do webové AI (jako je ChatGPT nebo Claude), poté zkopírovat odpověď AI zpět do dialogového okna a kliknout na tlačítko potvrzení.",
28+
"monitorInterval": "Interval monitorování schránky (milisekundy)",
29+
"intervalValue": "{{value}} milisekund"
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"dialogTitle": "Menschliche Weiterleitung - Bitte helfen Sie beim Kopieren und Einfügen von Informationen",
3+
"dialogDescription": "Bitte kopieren Sie den folgenden Prompt in die Web-KI und fügen Sie dann die Antwort der KI in das untenstehende Textfeld ein.",
4+
"copiedToClipboard": "In die Zwischenablage kopiert",
5+
"warning": {
6+
"lastInteraction": "Es sieht so aus, als hätten Sie die KI-Antwort aus der letzten Interaktion kopiert, nicht die Antwort für die aktuelle Aufgabe. Bitte überprüfen Sie Ihre Interaktion mit der Web-KI.",
7+
"invalidResponse": "Die Antwort der KI scheint nicht den Formatanforderungen von RooCode zu entsprechen. Bitte überprüfen Sie Ihre Interaktion mit der Web-KI."
8+
},
9+
"clipboardMonitoring": {
10+
"label": "Zwischenablage-Überwachung:",
11+
"enabled": "Aktiviert",
12+
"disabled": "Deaktiviert",
13+
"disable": "Deaktivieren",
14+
"enable": "Aktivieren"
15+
},
16+
"shortcutDescription": "Sie können den Tastaturkurzbefehl Strg/Cmd+Alt+V (Standard) verwenden, um den Inhalt der Zwischenablage schnell zu senden. Sie können den Kurzbefehl auch ändern, indem Sie in den Tastaturkurzbefehl-Einstellungen nach 'Zwischenablage senden' suchen.",
17+
"aiResponse": {
18+
"label": "KI-Antwort eingeben:",
19+
"placeholder": "Fügen Sie hier die Antwort der KI ein..."
20+
},
21+
"actions": {
22+
"cancel": "Abbrechen",
23+
"submit": "Absenden"
24+
},
25+
"settings": {
26+
"description": "Es wird kein API-Schlüssel benötigt, aber Benutzer müssen beim Kopieren und Einfügen von Informationen in den webbasierten KI-Chat helfen.",
27+
"usage": "Bei der Verwendung erscheint ein Dialog und die aktuelle Nachricht wird automatisch in die Zwischenablage kopiert. Sie müssen diesen Inhalt in die webbasierte KI (wie ChatGPT oder Claude) einfügen, dann die Antwort der KI zurück in den Dialog kopieren und auf die Bestätigungsschaltfläche klicken.",
28+
"monitorInterval": "Zwischenablage-Überwachungsintervall (Millisekunden)",
29+
"intervalValue": "{{value}} Millisekunden"
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"dialogTitle": "Human Relay - Please help copy and paste information",
3+
"dialogDescription": "Please copy the following prompt to the web AI, and then paste the AI's response into the text box below.",
4+
"copiedToClipboard": "Copied to clipboard",
5+
"warning": {
6+
"lastInteraction": "It looks like you copied the AI response from the last interaction, not the response for the current task. Please check your interaction with the web AI.",
7+
"invalidResponse": "The AI's response doesn't seem to meet the RooCode format requirements. Please check your interaction with the web AI."
8+
},
9+
"clipboardMonitoring": {
10+
"label": "Clipboard monitoring:",
11+
"enabled": "Enabled",
12+
"disabled": "Disabled",
13+
"disable": "Disable",
14+
"enable": "Enable"
15+
},
16+
"shortcutDescription": "You can use the shortcut Ctrl/Cmd+Alt+V (default) to quickly send clipboard content. You can also change the shortcut by searching for 'send clipboard' in the keyboard shortcuts settings.",
17+
"aiResponse": {
18+
"label": "Enter AI response:",
19+
"placeholder": "Paste the AI's response here..."
20+
},
21+
"actions": {
22+
"cancel": "Cancel",
23+
"submit": "Submit"
24+
},
25+
"settings": {
26+
"description": "No API key is required, but users need to help copy and paste information to the web-based AI chat.",
27+
"usage": "When using, a dialog will appear and the current message will be automatically copied to the clipboard. You need to paste this content into the web-based AI (such as ChatGPT or Claude), then copy the AI's response back to the dialog and click the confirm button.",
28+
"monitorInterval": "Clipboard monitoring interval (milliseconds)",
29+
"intervalValue": "{{value}} milliseconds"
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"dialogTitle": "Relevo Humano - Por favor, ayude a copiar y pegar información",
3+
"dialogDescription": "Por favor, copie el siguiente prompt en la IA web y luego pegue la respuesta de la IA en el cuadro de texto de abajo.",
4+
"copiedToClipboard": "Copiado al portapapeles",
5+
"warning": {
6+
"lastInteraction": "Parece que ha copiado la respuesta de la IA de la última interacción, no la respuesta para la tarea actual. Por favor, verifique su interacción con la IA web.",
7+
"invalidResponse": "La respuesta de la IA parece no cumplir con los requisitos de formato de RooCode. Por favor, verifique su interacción con la IA web."
8+
},
9+
"clipboardMonitoring": {
10+
"label": "Monitoreo del portapapeles:",
11+
"enabled": "Activado",
12+
"disabled": "Desactivado",
13+
"disable": "Desactivar",
14+
"enable": "Activar"
15+
},
16+
"shortcutDescription": "Puede usar el atajo Ctrl/Cmd+Alt+V (predeterminado) para enviar rápidamente el contenido del portapapeles. También puede cambiar el atajo buscando 'enviar portapapeles' en la configuración de atajos de teclado.",
17+
"aiResponse": {
18+
"label": "Ingrese la respuesta de la IA:",
19+
"placeholder": "Pegue aquí la respuesta de la IA..."
20+
},
21+
"actions": {
22+
"cancel": "Cancelar",
23+
"submit": "Enviar"
24+
},
25+
"settings": {
26+
"description": "No se requiere clave de API, pero los usuarios necesitan ayudar a copiar y pegar información en el chat de IA basado en web.",
27+
"usage": "Al usar, aparecerá un diálogo y el mensaje actual se copiará automáticamente al portapapeles. Debe pegar este contenido en la IA basada en web (como ChatGPT o Claude), luego copiar la respuesta de la IA de vuelta al diálogo y hacer clic en el botón de confirmación.",
28+
"monitorInterval": "Intervalo de monitoreo del portapapeles (milisegundos)",
29+
"intervalValue": "{{value}} milisegundos"
30+
}
31+
}

0 commit comments

Comments
 (0)