Skip to content

Commit 3b116a2

Browse files
authored
I18n human relay (#1761)
* feat(i18n): Add i18n support for Human Relay dialog without monitoring * feat(i18n): add humanRelay.json translations for all supported languages - Created English version as base translation - Added translations for: ca, de, es, fr, hi, it, ja, ko, pl, pt-BR, tr, vi, zh-TW - Verified all translations are complete with no missing entries
1 parent 7ef4841 commit 3b116a2

File tree

16 files changed

+210
-13
lines changed

16 files changed

+210
-13
lines changed

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, D
44
import { Textarea } from "../ui/textarea"
55
import { useClipboard } from "../ui/hooks"
66
import { Check, Copy, X } from "lucide-react"
7+
import { useAppTranslation } from "@/i18n/TranslationContext"
78

89
interface HumanRelayDialogProps {
910
isOpen: boolean
@@ -26,19 +27,20 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
2627
onSubmit,
2728
onCancel,
2829
}) => {
30+
const { t } = useAppTranslation()
2931
const [response, setResponse] = React.useState("")
3032
const { copy } = useClipboard()
3133
const [isCopyClicked, setIsCopyClicked] = React.useState(false)
3234

33-
// Listen to isOpen changes, clear the input box when the dialog box is opened
35+
// Clear input when dialog opens
3436
React.useEffect(() => {
3537
if (isOpen) {
3638
setResponse("")
3739
setIsCopyClicked(false)
3840
}
3941
}, [isOpen])
4042

41-
// Copy to clipboard and show a success message
43+
// Copy to clipboard and show success message
4244
const handleCopy = () => {
4345
copy(promptText)
4446
setIsCopyClicked(true)
@@ -47,7 +49,7 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
4749
}, 2000)
4850
}
4951

50-
// Submit the response
52+
// Submit response
5153
const handleSubmit = (e: React.FormEvent) => {
5254
e.preventDefault()
5355
if (response.trim()) {
@@ -56,7 +58,7 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
5658
}
5759
}
5860

59-
// Cancel the operation
61+
// Cancel operation
6062
const handleCancel = () => {
6163
onCancel(requestId)
6264
onClose()
@@ -66,10 +68,8 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
6668
<Dialog open={isOpen} onOpenChange={(open) => !open && handleCancel()}>
6769
<DialogContent className="sm:max-w-[600px]">
6870
<DialogHeader>
69-
<DialogTitle>Human Relay - Please Help Copy and Paste Information</DialogTitle>
70-
<DialogDescription>
71-
Please copy the text below to the web AI, then paste the AI's response into the input box below.
72-
</DialogDescription>
71+
<DialogTitle>{t("humanRelay:dialogTitle")}</DialogTitle>
72+
<DialogDescription>{t("humanRelay:dialogDescription")}</DialogDescription>
7373
</DialogHeader>
7474

7575
<div className="grid gap-4 py-4">
@@ -84,12 +84,14 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
8484
</Button>
8585
</div>
8686

87-
{isCopyClicked && <div className="text-sm text-emerald-500 font-medium">Copied to clipboard</div>}
87+
{isCopyClicked && (
88+
<div className="text-sm text-emerald-500 font-medium">{t("humanRelay:copiedToClipboard")}</div>
89+
)}
8890

8991
<div>
90-
<div className="mb-2 font-medium">Please enter the AI's response:</div>
92+
<div className="mb-2 font-medium">{t("humanRelay:aiResponse.label")}</div>
9193
<Textarea
92-
placeholder="Paste the AI's response here..."
94+
placeholder={t("humanRelay:aiResponse.placeholder")}
9395
value={response}
9496
onChange={(e) => setResponse(e.target.value)}
9597
className="min-h-[150px]"
@@ -100,11 +102,11 @@ export const HumanRelayDialog: React.FC<HumanRelayDialogProps> = ({
100102
<DialogFooter>
101103
<Button variant="outline" onClick={handleCancel} className="gap-1">
102104
<X className="h-4 w-4" />
103-
Cancel
105+
{t("humanRelay:actions.cancel")}
104106
</Button>
105107
<Button onClick={handleSubmit} disabled={!response.trim()} className="gap-1">
106108
<Check className="h-4 w-4" />
107-
Submit
109+
{t("humanRelay:actions.submit")}
108110
</Button>
109111
</DialogFooter>
110112
</DialogContent>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "Relé Humà - Si us plau, ajudeu a copiar/enganxar informació",
3+
"dialogDescription": "Si us plau, copieu el següent prompt a la IA web, després enganxeu la resposta de la IA al quadre d'entrada de sota.",
4+
"copiedToClipboard": "Copiat al porta-retalls",
5+
"aiResponse": {
6+
"label": "Si us plau, introduïu la resposta de la IA:",
7+
"placeholder": "Enganxeu aquí la resposta de la IA..."
8+
},
9+
"actions": {
10+
"cancel": "Cancel·lar",
11+
"submit": "Enviar"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "Menschliche Weiterleitung - Bitte helfen Sie beim Kopieren/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 Eingabefeld unten ein.",
4+
"copiedToClipboard": "In die Zwischenablage kopiert",
5+
"aiResponse": {
6+
"label": "Bitte geben Sie die KI-Antwort ein:",
7+
"placeholder": "KI-Antwort hier einfügen..."
8+
},
9+
"actions": {
10+
"cancel": "Abbrechen",
11+
"submit": "Absenden"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "Human Relay - Please Help Copy/Paste Information",
3+
"dialogDescription": "Please copy the following prompt to the web AI, then paste the AI's response in the input box below.",
4+
"copiedToClipboard": "Copied to clipboard",
5+
"aiResponse": {
6+
"label": "Please enter AI's response:",
7+
"placeholder": "Paste AI's response here..."
8+
},
9+
"actions": {
10+
"cancel": "Cancel",
11+
"submit": "Submit"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "Relevo Humano - Por favor ayude a copiar/pegar información",
3+
"dialogDescription": "Por favor copie el siguiente mensaje en la IA web, luego pegue la respuesta de la IA en el cuadro de entrada a continuación.",
4+
"copiedToClipboard": "Copiado al portapapeles",
5+
"aiResponse": {
6+
"label": "Por favor ingrese la respuesta de la IA:",
7+
"placeholder": "Pegue la respuesta de la IA aquí..."
8+
},
9+
"actions": {
10+
"cancel": "Cancelar",
11+
"submit": "Enviar"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "Relais Humain - Veuillez aider à copier/coller les informations",
3+
"dialogDescription": "Veuillez copier le texte suivant dans l'IA web, puis collez la réponse de l'IA dans la zone de saisie ci-dessous.",
4+
"copiedToClipboard": "Copié dans le presse-papiers",
5+
"aiResponse": {
6+
"label": "Veuillez saisir la réponse de l'IA :",
7+
"placeholder": "Collez la réponse de l'IA ici..."
8+
},
9+
"actions": {
10+
"cancel": "Annuler",
11+
"submit": "Envoyer"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "मानव रिले - कृपया जानकारी कॉपी-पेस्ट करने में सहायता करें",
3+
"dialogDescription": "कृपया निम्नलिखित प्रॉम्प्ट को वेब AI में कॉपी करें, फिर AI की प्रतिक्रिया को नीचे दिए गए इनपुट बॉक्स में पेस्ट करें।",
4+
"copiedToClipboard": "क्लिपबोर्ड पर कॉपी किया गया",
5+
"aiResponse": {
6+
"label": "कृपया AI की प्रतिक्रिया दर्ज करें:",
7+
"placeholder": "यहाँ AI की प्रतिक्रिया पेस्ट करें..."
8+
},
9+
"actions": {
10+
"cancel": "रद्द करें",
11+
"submit": "जमा करें"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "Relay Umano - Aiuta a copiare/incollare le informazioni",
3+
"dialogDescription": "Copia il seguente prompt nell'AI web, quindi incolla la risposta dell'AI nella casella di input sottostante.",
4+
"copiedToClipboard": "Copiato negli appunti",
5+
"aiResponse": {
6+
"label": "Inserisci la risposta dell'AI:",
7+
"placeholder": "Incolla qui la risposta dell'AI..."
8+
},
9+
"actions": {
10+
"cancel": "Annulla",
11+
"submit": "Invia"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "ヒューマンリレー - 情報のコピー&ペーストにご協力ください",
3+
"dialogDescription": "以下のプロンプトをウェブAIにコピーし、AIの応答を下の入力ボックスにペーストしてください。",
4+
"copiedToClipboard": "クリップボードにコピーしました",
5+
"aiResponse": {
6+
"label": "AIの応答を入力してください:",
7+
"placeholder": "ここにAIの応答をペースト..."
8+
},
9+
"actions": {
10+
"cancel": "キャンセル",
11+
"submit": "送信"
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"dialogTitle": "휴먼 릴레이 - 정보 복사/붙여넣기를 도와주세요",
3+
"dialogDescription": "다음 프롬프트를 웹 AI에 복사하고, AI의 응답을 아래 입력창에 붙여넣어 주세요.",
4+
"copiedToClipboard": "클립보드에 복사됨",
5+
"aiResponse": {
6+
"label": "AI의 응답을 입력해주세요:",
7+
"placeholder": "여기에 AI의 응답을 붙여넣으세요..."
8+
},
9+
"actions": {
10+
"cancel": "취소",
11+
"submit": "제출"
12+
}
13+
}

0 commit comments

Comments
 (0)