mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-30 20:25:33 +00:00
enahnce: enhance translations
This commit is contained in:
parent
5bd552199b
commit
3ac111b2f5
12 changed files with 70 additions and 35 deletions
|
|
@ -10,9 +10,6 @@ import {
|
|||
ChevronRight,
|
||||
ChevronDown,
|
||||
AlertTriangle,
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
RotateCcw,
|
||||
} from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
|
@ -24,6 +21,7 @@ import { proxyFetchGet } from '@/api/http';
|
|||
import { useTranslation } from 'react-i18next';
|
||||
import useChatStoreAdapter from '@/hooks/useChatStoreAdapter';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { ZoomControls } from './ZoomControls';
|
||||
|
||||
// Type definitions
|
||||
interface FileTreeNode {
|
||||
|
|
@ -549,22 +547,22 @@ export default function Folder({ data }: { data?: Agent }) {
|
|||
{selectedFile?.type === 'html' && !isShowSourceCode && htmlHasScripts && !htmlScriptsApproved && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="primary"
|
||||
variant="success"
|
||||
className="flex-shrink-0"
|
||||
onClick={() => {
|
||||
setHtmlScriptsApproved(true);
|
||||
toast.success('Scripts approved. Rendering with full functionality.', {
|
||||
toast.success(t('chat.scripts-approved'), {
|
||||
duration: 3000,
|
||||
});
|
||||
}}
|
||||
>
|
||||
Safe to Run
|
||||
{t('chat.safe-to-run')}
|
||||
</Button>
|
||||
)}
|
||||
{selectedFile?.type === 'html' && !isShowSourceCode && htmlScriptsApproved && htmlHasScripts && (
|
||||
<span className="text-xs text-yellow-600 flex items-center gap-1 flex-shrink-0">
|
||||
<AlertTriangle className="w-3 h-3" />
|
||||
Scripts running
|
||||
{t('chat.scripts-running')}
|
||||
</span>
|
||||
)}
|
||||
<Button
|
||||
|
|
@ -714,6 +712,7 @@ function HtmlRenderer({
|
|||
scriptsApproved: boolean;
|
||||
onScriptsDetected: (hasScripts: boolean) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [processedHtml, setProcessedHtml] = useState<string>('');
|
||||
const [hasScripts, setHasScripts] = useState<boolean>(false);
|
||||
const [rawHtmlWithScriptsCache, setRawHtmlWithScriptsCache] = useState<string>('');
|
||||
|
|
@ -766,7 +765,7 @@ function HtmlRenderer({
|
|||
hasShownWarningRef.current = selectedFile.path;
|
||||
setHasScripts(true);
|
||||
onScriptsDetected(true);
|
||||
toast.warning('HTML render found related scripts. Make sure scripts are safe to run.', {
|
||||
toast.warning(t('chat.scripts-warning'), {
|
||||
duration: 5000,
|
||||
icon: <AlertTriangle className="w-4 h-4" />,
|
||||
});
|
||||
|
|
@ -1128,22 +1127,14 @@ function HtmlRenderer({
|
|||
};
|
||||
|
||||
return (
|
||||
<div className="w-full h-full flex flex-col">
|
||||
{/* Toolbar with zoom controls */}
|
||||
<div className="flex items-center justify-center gap-2 p-2 border-b border-zinc-200 bg-zinc-50 flex-shrink-0">
|
||||
<div className="flex items-center gap-1">
|
||||
<Button size="icon" variant="ghost" onClick={handleZoomOut} title="Zoom Out">
|
||||
<ZoomOut className="w-4 h-4" />
|
||||
</Button>
|
||||
<span className="text-sm text-zinc-600 min-w-[3rem] text-center">{zoom}%</span>
|
||||
<Button size="icon" variant="ghost" onClick={handleZoomIn} title="Zoom In">
|
||||
<ZoomIn className="w-4 h-4" />
|
||||
</Button>
|
||||
<Button size="icon" variant="ghost" onClick={handleZoomReset} title="Reset Zoom">
|
||||
<RotateCcw className="w-4 h-4" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="w-full h-full flex flex-col relative">
|
||||
{/* Floating notch-style zoom controls */}
|
||||
<ZoomControls
|
||||
zoom={zoom}
|
||||
onZoomIn={handleZoomIn}
|
||||
onZoomOut={handleZoomOut}
|
||||
onZoomReset={handleZoomReset}
|
||||
/>
|
||||
|
||||
{/* Content area with zoom */}
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -47,5 +47,9 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": ".لقد وصل تخزينك السحابي إلى الحد الأقصى لخطة الاشتراك الحالية الخاصة بك",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": ".نواجه حركة مرور عالية. يرجى المحاولة مرة أخرى بعد وقت قصيرة",
|
||||
"new-project": "مشروع جديد",
|
||||
"no-reply-received-task-continue": "لم يتم استلام رد، تستمر المهمة"
|
||||
"no-reply-received-task-continue": "لم يتم استلام رد، تستمر المهمة",
|
||||
"safe-to-run": "آمن للتشغيل",
|
||||
"scripts-running": "البرامج النصية قيد التشغيل",
|
||||
"scripts-warning": "وجد عارض HTML برامج نصية ذات صلة. تأكد من أن البرامج النصية آمنة للتشغيل.",
|
||||
"scripts-approved": "تمت الموافقة على البرامج النصية. يتم العرض بكامل الوظائف."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "Ihr Cloud-Speicher hat das Limit Ihres aktuellen Plans erreicht.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "Wir erleben hohen Datenverkehr. Bitte versuchen Sie es in wenigen Augenblicken erneut.",
|
||||
"new-project": "Neues Projekt",
|
||||
"no-reply-received-task-continue": "Keine Antwort erhalten, Aufgabe wird fortgesetzt"
|
||||
"no-reply-received-task-continue": "Keine Antwort erhalten, Aufgabe wird fortgesetzt",
|
||||
"safe-to-run": "Sicher ausführen",
|
||||
"scripts-running": "Skripte werden ausgeführt",
|
||||
"scripts-warning": "HTML-Renderer hat verwandte Skripte gefunden. Stellen Sie sicher, dass die Skripte sicher sind.",
|
||||
"scripts-approved": "Skripte genehmigt. Rendering mit voller Funktionalität."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "Your cloud storage has reached the limit of your current plan.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "We're experiencing high traffic. Please try again in a few moments.",
|
||||
"new-project": "Untitled Project",
|
||||
"no-reply-received-task-continue": "No reply received, task continue"
|
||||
"no-reply-received-task-continue": "No reply received, task continue",
|
||||
"safe-to-run": "Safe to Run",
|
||||
"scripts-running": "Scripts running",
|
||||
"scripts-warning": "HTML render found related scripts. Make sure scripts are safe to run.",
|
||||
"scripts-approved": "Scripts approved. Rendering with full functionality."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "Tu almacenamiento en la nube ha alcanzado el límite de tu plan actual.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "Estamos experimentando mucho tráfico. Inténtalo de nuevo en unos momentos.",
|
||||
"new-project": "Nuevo proyecto",
|
||||
"no-reply-received-task-continue": "No se recibió respuesta, la tarea continúa"
|
||||
"no-reply-received-task-continue": "No se recibió respuesta, la tarea continúa",
|
||||
"safe-to-run": "Ejecutar de forma segura",
|
||||
"scripts-running": "Scripts en ejecución",
|
||||
"scripts-warning": "El renderizador HTML encontró scripts relacionados. Asegúrese de que los scripts sean seguros.",
|
||||
"scripts-approved": "Scripts aprobados. Renderizando con funcionalidad completa."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,5 +47,9 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "Votre stockage cloud a atteint la limite de votre plan actuel.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "Nous connaissons un trafic élevé. Veuillez réessayer dans quelques instants.",
|
||||
"new-project": "Nouveau projet",
|
||||
"no-reply-received-task-continue": "Aucune réponse reçue, la tâche continue"
|
||||
"no-reply-received-task-continue": "Aucune réponse reçue, la tâche continue",
|
||||
"safe-to-run": "Exécuter en toute sécurité",
|
||||
"scripts-running": "Scripts en cours d'exécution",
|
||||
"scripts-warning": "Le rendu HTML a trouvé des scripts associés. Assurez-vous que les scripts sont sûrs.",
|
||||
"scripts-approved": "Scripts approuvés. Rendu avec toutes les fonctionnalités."
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "Il tuo spazio di archiviazione cloud ha raggiunto il limite del tuo piano attuale.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "Stiamo riscontrando un traffico elevato. Riprova tra qualche istante.",
|
||||
"new-project": "Nuovo Progetto",
|
||||
"no-reply-received-task-continue": "Nessuna risposta ricevuta, il compito continua"
|
||||
"no-reply-received-task-continue": "Nessuna risposta ricevuta, il compito continua",
|
||||
"safe-to-run": "Esegui in sicurezza",
|
||||
"scripts-running": "Script in esecuzione",
|
||||
"scripts-warning": "Il renderer HTML ha trovato script correlati. Assicurati che gli script siano sicuri.",
|
||||
"scripts-approved": "Script approvati. Rendering con funzionalità complete."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "クラウドストレージが現在のプランの制限に達しました。",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "トラフィックが多いため、しばらくしてからもう一度お試しください。",
|
||||
"new-project": "新規プロジェクト",
|
||||
"no-reply-received-task-continue": "応答がないため、タスクを続行します"
|
||||
"no-reply-received-task-continue": "応答がないため、タスクを続行します",
|
||||
"safe-to-run": "安全に実行",
|
||||
"scripts-running": "スクリプト実行中",
|
||||
"scripts-warning": "HTMLレンダラーが関連スクリプトを検出しました。スクリプトが安全であることを確認してください。",
|
||||
"scripts-approved": "スクリプトが承認されました。完全な機能でレンダリングしています。"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "클라우드 스토리지가 현재 플랜의 한도에 도달했습니다.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "트래픽이 많습니다. 잠시 후 다시 시도해 주세요.",
|
||||
"new-project": "새 프로젝트",
|
||||
"no-reply-received-task-continue": "응답이 없으므로 작업을 계속합니다."
|
||||
"no-reply-received-task-continue": "응답이 없으므로 작업을 계속합니다.",
|
||||
"safe-to-run": "안전하게 실행",
|
||||
"scripts-running": "스크립트 실행 중",
|
||||
"scripts-warning": "HTML 렌더러가 관련 스크립트를 발견했습니다. 스크립트가 안전한지 확인하세요.",
|
||||
"scripts-approved": "스크립트가 승인되었습니다. 전체 기능으로 렌더링 중입니다."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "Ваше облачное хранилище достигло лимита вашего текущего плана.",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "Мы испытываем высокую нагрузку. Пожалуйста, попробуйте еще раз через несколько минут.",
|
||||
"new-project": "Новый проект",
|
||||
"no-reply-received-task-continue": "Ответ не получен, задача продолжается"
|
||||
"no-reply-received-task-continue": "Ответ не получен, задача продолжается",
|
||||
"safe-to-run": "Безопасно запустить",
|
||||
"scripts-running": "Скрипты выполняются",
|
||||
"scripts-warning": "HTML-рендерер обнаружил связанные скрипты. Убедитесь, что скрипты безопасны.",
|
||||
"scripts-approved": "Скрипты одобрены. Рендеринг с полной функциональностью."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,5 +47,9 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "您的云存储已达到当前计划的限制。",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "我们正在经历高流量。请稍后再试。",
|
||||
"new-project": "新项目",
|
||||
"no-reply-received-task-continue": "没有收到回复,任务继续"
|
||||
"no-reply-received-task-continue": "没有收到回复,任务继续",
|
||||
"safe-to-run": "安全运行",
|
||||
"scripts-running": "脚本运行中",
|
||||
"scripts-warning": "HTML渲染器发现相关脚本。请确保脚本可以安全运行。",
|
||||
"scripts-approved": "脚本已批准。正在以完整功能渲染。"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,5 +47,9 @@
|
|||
"your-cloud-storage-has-reached-the-limit-of-your-current-plan": "您的雲存儲已達到當前計劃的限制。",
|
||||
"we-re-experiencing-high-traffic-please-try-again-in-a-few-moments": "我們正在經歷高流量。請稍後再試。",
|
||||
"new-project": "新項目",
|
||||
"no-reply-received-task-continue": "沒有收到回复,任務繼續"
|
||||
"no-reply-received-task-continue": "沒有收到回复,任務繼續",
|
||||
"safe-to-run": "安全運行",
|
||||
"scripts-running": "腳本運行中",
|
||||
"scripts-warning": "HTML渲染器發現相關腳本。請確保腳本可以安全運行。",
|
||||
"scripts-approved": "腳本已批准。正在以完整功能渲染。"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue