# -*- coding: utf-8 -*-
"""Grader feature translations for OpenJudge Studio.

Contains translations for:
- Grader feature header and description
- Sidebar settings (grader selection, evaluation settings)
- Input panel (query, response, context fields)
- Result panel
- Batch evaluation (upload, progress, history, results)
- Help/guide content

Key prefix conventions:
- grader.*           : General grader feature
- grader.sidebar.*   : Sidebar settings
- grader.input.*     : Input panel
- grader.result.*    : Result panel
- grader.batch.*     : Batch evaluation
- grader.help.*      : Help content
"""

# =============================================================================
# English Translations
# =============================================================================
EN: dict[str, str] = {
    # Feature Info
    "grader.name": "Grader Evaluation",
    "grader.description": "Evaluate data using built-in Graders (single and batch)",
    # Tabs
    "grader.tabs.single": "Single Evaluation",
    "grader.tabs.batch": "Batch Evaluation",
    "grader.tabs.history": "History",
    "grader.tabs.help": "Help",
    # Sidebar - Grader Settings
    "grader.sidebar.grader": "Grader",
    "grader.sidebar.category": "Category",
    "grader.sidebar.category_help": "Select grader category",
    "grader.sidebar.no_graders": "No graders in this category",
    # Sidebar - Evaluation Settings
    "grader.sidebar.settings": "Settings",
    "grader.sidebar.language": "Language",
    "grader.sidebar.language_help": "Evaluation language",
    "grader.sidebar.threshold": "Threshold",
    "grader.sidebar.threshold_help": "Pass threshold",
    "grader.sidebar.advanced_options": "Advanced Options",
    # Sidebar - Batch Settings
    "grader.sidebar.batch_settings": "Batch Settings",
    "grader.sidebar.max_concurrency": "Max Concurrency",
    "grader.sidebar.max_concurrency_help": (
        "Maximum number of concurrent evaluations. Higher values may hit API rate limits."
    ),
    # Sidebar - Vision Warning
    "grader.sidebar.vision_warning": (
        "This grader requires a vision-capable model (e.g., qwen-vl-max-latest, gpt-4o, gpt-5.2)"
    ),
    # Input Panel
    "grader.input.title": "Input Data",
    "grader.input.load_example": "Load Example",
    "grader.input.clear_all": "Clear All",
    "grader.input.select_grader_first": "Please select a grader from the sidebar",
    # Input Panel - Standard Fields
    "grader.input.query": "Query",
    "grader.input.query_placeholder": "Enter the user's question or prompt...",
    "grader.input.query_help": "The original question or prompt from the user",
    "grader.input.response": "Response to Evaluate",
    "grader.input.response_placeholder": "Enter the response to be evaluated...",
    "grader.input.response_help": "The model's response that needs to be evaluated",
    "grader.input.reference": "Reference Response",
    "grader.input.reference_required": "Reference Response *",
    "grader.input.reference_optional": "Reference Response (Optional)",
    "grader.input.reference_placeholder": "Enter the reference/golden answer...",
    "grader.input.reference_help": "The expected or ideal response for comparison",
    "grader.input.context": "Additional Context",
    "grader.input.context_placeholder": "Enter any additional context that might help with evaluation...",
    "grader.input.context_help": "Optional background information for the evaluation",
    # Input Panel - Tabs
    "grader.input.tab_main": "Main Input",
    "grader.input.tab_query": "Query",
    "grader.input.tab_tools": "Tools",
    "grader.input.tab_context": "Context",
    # Input Panel - Agent Fields
    "grader.input.agent_query_placeholder": "Enter the user's query to the agent...",
    "grader.input.agent_query_help": "The task or question given to the agent",
    "grader.input.tool_definitions": "Available Tool Definitions (JSON)",
    "grader.input.tool_definitions_placeholder": '[{"name": "get_weather", "description": "...", "parameters": {...}}]',
    "grader.input.tool_definitions_help": "JSON array of available tool definitions",
    "grader.input.tool_definitions_info": "Enter tool definitions and calls in JSON format",
    "grader.input.tool_calls": "Agent's Tool Calls (JSON)",
    "grader.input.tool_calls_placeholder": '[{"name": "get_weather", "arguments": {"location": "Beijing"}}]',
    "grader.input.tool_calls_help": "JSON array of tool calls made by the agent",
    "grader.input.reference_tool_calls": "Expected Tool Calls (JSON)",
    "grader.input.reference_tool_calls_help": "JSON array of expected/correct tool calls",
    # Input Panel - Run Button
    "grader.input.run": "Run Evaluation",
    "grader.input.missing": "Missing",
    "grader.input.missing_api_key": "API Key",
    "grader.input.missing_model": "Model",
    "grader.input.missing_grader": "Grader",
    "grader.input.missing_data": "Required input data",
    # Result Panel
    "grader.result.title": "Evaluation Result",
    "grader.result.empty": "Run an evaluation to see results here",
    "grader.result.score": "Score",
    "grader.result.passed": "Passed",
    "grader.result.failed": "Failed",
    "grader.result.reasoning": "Reasoning",
    "grader.result.details": "Details",
    "grader.result.raw_output": "Raw Output",
    "grader.result.error": "Evaluation Error",
    "grader.result.time": "Time",
    "grader.result.threshold": "Threshold",
    # Batch - Upload Panel
    "grader.batch.upload_title": "Upload Data",
    "grader.batch.select_grader_first": "Please select a grader from the sidebar",
    "grader.batch.format_requirements": "Data Format Requirements",
    "grader.batch.required_fields": "Required fields",
    "grader.batch.optional_fields": "Optional fields",
    "grader.batch.agent_json_note": "Agent graders require JSON format. CSV is not supported for complex fields.",
    "grader.batch.download_samples": "Download Sample Files",
    "grader.batch.download_json": "Download JSON Sample",
    "grader.batch.download_csv": "Download CSV Sample",
    "grader.batch.csv_not_supported": "CSV not supported",
    "grader.batch.csv_not_supported_help": "Agent graders require JSON format",
    "grader.batch.supported_formats": "Supported formats: JSON, CSV | Max records: {max}",
    "grader.batch.upload_label": "Upload evaluation data",
    "grader.batch.upload_help": "Upload JSON or CSV file with up to {max} records",
    "grader.batch.parsing": "Parsing file...",
    "grader.batch.data_preview": "Data Preview",
    "grader.batch.preview_count": "showing {shown} of {total} records",
    "grader.batch.validation_success": "Data validated successfully!",
    "grader.batch.records_ready": "{count} records ready for evaluation",
    "grader.batch.drop_file": "Drag and drop a file here or click to browse",
    # Batch - Start Button
    "grader.batch.start": "Start Batch Evaluation",
    "grader.batch.missing_data": "Valid data file",
    "grader.batch.missing_api_key": "API Key",
    "grader.batch.missing_grader": "Grader selection",
    # Batch - Progress Panel
    "grader.batch.progress_title": "Evaluation Progress",
    "grader.batch.progress_empty": "Upload data and start evaluation to see progress",
    "grader.batch.progress_text": "Progress: {completed}/{total}",
    "grader.batch.progress_success": "{count} success",
    "grader.batch.progress_failed": "{count} failed",
    "grader.batch.running": "Running Batch Evaluation...",
    "grader.batch.task_id": "Task ID",
    "grader.batch.grader": "Grader",
    "grader.batch.data_count": "Data count",
    "grader.batch.max_concurrency": "Max concurrency",
    "grader.batch.starting": "Starting evaluation...",
    "grader.batch.complete": "Evaluation Complete!",
    "grader.batch.completed_count": "Completed",
    "grader.batch.success_count": "Success",
    "grader.batch.failed_count": "Failed",
    "grader.batch.avg_score": "Average Score",
    "grader.batch.pass_rate": "Pass Rate",
    "grader.batch.failed_status": "Evaluation Failed",
    "grader.batch.resume_tip": "Tip: Check the History tab to see partial results or resume.",
    # Batch - History Panel
    "grader.batch.history_title": "Batch Evaluation History",
    "grader.batch.history_empty": "No batch evaluation history yet",
    "grader.batch.history_empty_hint": "Start a batch evaluation to see it here",
    "grader.batch.history_count": "Showing {count} evaluation(s)",
    "grader.batch.incomplete_tasks": "{count} incomplete task(s) can be resumed",
    "grader.batch.view": "View",
    "grader.batch.resume": "Resume",
    "grader.batch.delete": "Delete",
    "grader.batch.back_to_history": "Back to History",
    "grader.batch.task_not_found": "Task not found",
    "grader.batch.task_deleted": "Task {task_id} deleted",
    "grader.batch.delete_failed": "Failed to delete task",
    # Batch - Result Panel
    "grader.batch.result_title": "Evaluation Results",
    "grader.batch.summary": "Summary",
    "grader.batch.total_records": "Total Records",
    "grader.batch.export_results": "Export Results",
    "grader.batch.export_json": "Export JSON",
    "grader.batch.export_csv": "Export CSV",
    "grader.batch.score_distribution": "Score Distribution",
    "grader.batch.detailed_results": "Detailed Results",
    # Batch - Resume
    "grader.batch.resume_warning": "To resume a task, please configure your API Key in the sidebar first.",
    "grader.batch.resume_api_required": "API Key is required to resume evaluation. Please configure it in the sidebar.",
    "grader.batch.resuming": "Resuming task: {task_id}...",
    "grader.batch.resuming_status": "Resuming Batch Evaluation...",
    "grader.batch.resume_complete": "Resume Complete!",
    "grader.batch.resume_failed": "Failed to resume task. Checkpoint may be corrupted.",
    # Help - Quick Guide
    "grader.help.title": "Quick Start Guide",
    "grader.help.single_title": "Single Evaluation",
    "grader.help.single_step1": "Configure API endpoint and key in sidebar",
    "grader.help.single_step2": "Select grader category and specific grader",
    "grader.help.single_step3": "Enter evaluation data (query, response, etc.)",
    "grader.help.single_step4": 'Click "Run Evaluation" to see results',
    "grader.help.batch_title": "Batch Evaluation",
    "grader.help.batch_step1": "Configure API and select grader (same as single)",
    "grader.help.batch_step2": "Upload JSON or CSV file with evaluation data",
    "grader.help.batch_step3": 'Click "Start Batch Evaluation"',
    "grader.help.batch_step4": "View results and export (supports resume if interrupted)",
    # Help - Data Format
    "grader.help.format_title": "Data Format Guide",
    "grader.help.json_format": "JSON Format",
    "grader.help.csv_format": "CSV Format",
    "grader.help.agent_note": "Note: Agent graders require JSON format for complex fields.",
    "grader.help.multimodal_note": "Multimodal graders are not supported for batch evaluation.",
    # Error messages
    "grader.error.no_data": "No data to evaluate",
    "grader.error.evaluation_failed": "Error: {error}",
    # Result Panel (Status)
    "grader.result.passed_status": "PASSED",
    "grader.result.failed_status": "FAILED",
    "grader.result.threshold_grader": "Threshold: {threshold} | Grader: {grader}",
    "grader.result.evaluation_reason": "Evaluation Reason",
    "grader.result.evaluation_failed": "Evaluation Failed",
    "grader.result.troubleshooting": "Troubleshooting Tips",
    "grader.result.tip_api_key": "Check if your API key is valid and has sufficient quota",
    "grader.result.tip_endpoint": "Verify the API endpoint matches your service provider",
    "grader.result.tip_model": "Ensure the selected model is available at your endpoint",
    "grader.result.tip_vision": "For multimodal graders, use a vision-capable model",
    "grader.result.tip_format": "Check that input data is in the correct format",
    "grader.result.running": "Running evaluation...",
    "grader.result.creating_model": "Creating model instance...",
    "grader.result.initializing": "Initializing {grader} grader...",
    "grader.result.running_eval": "Running evaluation...",
    "grader.result.complete": "Evaluation complete ({time})",
    "grader.result.failed_message": "Evaluation failed",
    "grader.result.ready": "Ready to Evaluate",
    "grader.result.ready_desc": "Enter your data and click <strong>Run Evaluation</strong> to see results",
    "grader.result.ready_tip": 'Tip: Use the "Load Example" button to try with sample data',
    "grader.result.view_metadata": "View Metadata",
    "grader.result.completed_in": "Completed in {time}",
    # Batch Result Panel
    "grader.batch.avg_score_short": "Avg Score",
    "grader.batch.pass_rate_label": "Pass Rate",
    "grader.batch.success_failed": "Success / Failed",
    "grader.batch.of_total": "of {total} total",
    "grader.batch.score_distribution_label": "Score Distribution",
    "grader.batch.filter": "Filter",
    "grader.batch.sort": "Sort",
    "grader.batch.filter_all": "All",
    "grader.batch.filter_passed": "Passed",
    "grader.batch.filter_failed": "Failed",
    "grader.batch.filter_errors": "Errors",
    "grader.batch.sort_index_asc": "Index ↑",
    "grader.batch.sort_index_desc": "Index ↓",
    "grader.batch.sort_score_asc": "Score ↑",
    "grader.batch.sort_score_desc": "Score ↓",
    "grader.batch.page": "Page",
    "grader.batch.showing_results": "Showing {start}-{end} of {total} results (Page {page}/{pages})",
    "grader.batch.details_for": "Details for #{index}",
    "grader.batch.error_label": "Error:",
    "grader.batch.reason_label": "Reason:",
    "grader.batch.input_data_label": "Input Data:",
    "grader.batch.export_json_btn": "Export JSON",
    "grader.batch.export_csv_btn": "Export CSV",
    "grader.batch.no_results_yet": "No results yet. Run an evaluation to see results here.",
    "grader.batch.detailed_results_label": "Detailed Results",
    "grader.batch.results_will_appear": "Results will appear here after evaluation completes",
}

# =============================================================================
# Chinese Translations
# =============================================================================
ZH: dict[str, str] = {
    # Feature Info
    "grader.name": "Grader 评估",
    "grader.description": "使用内置 Grader 评估数据（支持单条和批量）",
    # Tabs
    "grader.tabs.single": "单条评估",
    "grader.tabs.batch": "批量评估",
    "grader.tabs.history": "历史记录",
    "grader.tabs.help": "帮助",
    # Sidebar - Grader Settings
    "grader.sidebar.grader": "评估器",
    "grader.sidebar.category": "类别",
    "grader.sidebar.category_help": "选择评估器类别",
    "grader.sidebar.no_graders": "该类别下暂无评估器",
    # Sidebar - Evaluation Settings
    "grader.sidebar.settings": "设置",
    "grader.sidebar.language": "语言",
    "grader.sidebar.language_help": "评估语言",
    "grader.sidebar.threshold": "通过阈值",
    "grader.sidebar.threshold_help": "通过阈值",
    "grader.sidebar.advanced_options": "高级选项",
    # Sidebar - Batch Settings
    "grader.sidebar.batch_settings": "批量设置",
    "grader.sidebar.max_concurrency": "最大并发数",
    "grader.sidebar.max_concurrency_help": "最大并发评估数量。数值过高可能触发 API 速率限制。",
    # Sidebar - Vision Warning
    "grader.sidebar.vision_warning": "此评测器需要视觉模型（如 qwen-vl-max-latest、gpt-4o、gpt-5.2）",
    # Input Panel
    "grader.input.title": "输入数据",
    "grader.input.load_example": "加载示例",
    "grader.input.clear_all": "清空全部",
    "grader.input.select_grader_first": "请先在侧边栏选择评估器",
    # Input Panel - Standard Fields
    "grader.input.query": "问题",
    "grader.input.query_placeholder": "输入用户的问题或提示词...",
    "grader.input.query_help": "用户的原始问题或提示词",
    "grader.input.response": "待评估回答",
    "grader.input.response_placeholder": "输入待评估的回答...",
    "grader.input.response_help": "需要评估的模型回答",
    "grader.input.reference": "参考答案",
    "grader.input.reference_required": "参考答案 *",
    "grader.input.reference_optional": "参考答案（可选）",
    "grader.input.reference_placeholder": "输入参考/标准答案...",
    "grader.input.reference_help": "用于对比的预期或理想回答",
    "grader.input.context": "附加上下文",
    "grader.input.context_placeholder": "输入可能有助于评估的附加上下文...",
    "grader.input.context_help": "可选的评估背景信息",
    # Input Panel - Tabs
    "grader.input.tab_main": "主要输入",
    "grader.input.tab_query": "问题",
    "grader.input.tab_tools": "工具",
    "grader.input.tab_context": "上下文",
    # Input Panel - Agent Fields
    "grader.input.agent_query_placeholder": "输入给 Agent 的用户问题...",
    "grader.input.agent_query_help": "给 Agent 的任务或问题",
    "grader.input.tool_definitions": "可用工具定义 (JSON)",
    "grader.input.tool_definitions_placeholder": '[{"name": "get_weather", "description": "...", "parameters": {...}}]',
    "grader.input.tool_definitions_help": "可用工具定义的 JSON 数组",
    "grader.input.tool_definitions_info": "请输入 JSON 格式的工具定义和调用",
    "grader.input.tool_calls": "Agent 工具调用 (JSON)",
    "grader.input.tool_calls_placeholder": '[{"name": "get_weather", "arguments": {"location": "Beijing"}}]',
    "grader.input.tool_calls_help": "Agent 发起的工具调用的 JSON 数组",
    "grader.input.reference_tool_calls": "预期工具调用 (JSON)",
    "grader.input.reference_tool_calls_help": "预期/正确工具调用的 JSON 数组",
    # Input Panel - Run Button
    "grader.input.run": "运行评估",
    "grader.input.missing": "缺少",
    "grader.input.missing_api_key": "API 密钥",
    "grader.input.missing_model": "模型",
    "grader.input.missing_grader": "评估器",
    "grader.input.missing_data": "必需的输入数据",
    # Result Panel
    "grader.result.title": "评估结果",
    "grader.result.empty": "运行评估后在此查看结果",
    "grader.result.score": "分数",
    "grader.result.passed": "通过",
    "grader.result.failed": "未通过",
    "grader.result.reasoning": "评估理由",
    "grader.result.details": "详情",
    "grader.result.raw_output": "原始输出",
    "grader.result.error": "评估错误",
    "grader.result.time": "耗时",
    "grader.result.threshold": "阈值",
    # Batch - Upload Panel
    "grader.batch.upload_title": "上传数据",
    "grader.batch.select_grader_first": "请先在侧边栏选择评估器",
    "grader.batch.format_requirements": "数据格式要求",
    "grader.batch.required_fields": "必需字段",
    "grader.batch.optional_fields": "可选字段",
    "grader.batch.agent_json_note": "Agent 评估器需要 JSON 格式，CSV 不支持复杂字段。",
    "grader.batch.download_samples": "下载示例文件",
    "grader.batch.download_json": "下载 JSON 示例",
    "grader.batch.download_csv": "下载 CSV 示例",
    "grader.batch.csv_not_supported": "不支持 CSV",
    "grader.batch.csv_not_supported_help": "Agent 评估器需要 JSON 格式",
    "grader.batch.supported_formats": "支持格式：JSON、CSV | 最大记录数：{max}",
    "grader.batch.upload_label": "上传评估数据",
    "grader.batch.upload_help": "上传包含最多 {max} 条记录的 JSON 或 CSV 文件",
    "grader.batch.parsing": "正在解析文件...",
    "grader.batch.data_preview": "数据预览",
    "grader.batch.preview_count": "显示 {shown} / {total} 条记录",
    "grader.batch.validation_success": "数据验证通过！",
    "grader.batch.records_ready": "{count} 条数据准备就绪",
    "grader.batch.drop_file": "拖放文件到此处或点击选择文件",
    # Batch - Start Button
    "grader.batch.start": "开始批量评估",
    "grader.batch.missing_data": "有效数据文件",
    "grader.batch.missing_api_key": "API 密钥",
    "grader.batch.missing_grader": "评估器选择",
    # Batch - Progress Panel
    "grader.batch.progress_title": "评估进度",
    "grader.batch.progress_empty": "上传数据并开始评估后查看进度",
    "grader.batch.progress_text": "进度：{completed}/{total}",
    "grader.batch.progress_success": "{count} 成功",
    "grader.batch.progress_failed": "{count} 失败",
    "grader.batch.running": "正在运行批量评估...",
    "grader.batch.task_id": "任务 ID",
    "grader.batch.grader": "评估器",
    "grader.batch.data_count": "数据量",
    "grader.batch.max_concurrency": "最大并发",
    "grader.batch.starting": "正在启动评估...",
    "grader.batch.complete": "评估完成！",
    "grader.batch.completed_count": "已完成",
    "grader.batch.success_count": "成功",
    "grader.batch.failed_count": "失败",
    "grader.batch.avg_score": "平均分",
    "grader.batch.pass_rate": "通过率",
    "grader.batch.failed_status": "评估失败",
    "grader.batch.resume_tip": "提示：前往历史记录标签页查看部分结果或续传。",
    # Batch - History Panel
    "grader.batch.history_title": "批量评估历史",
    "grader.batch.history_empty": "暂无批量评估历史",
    "grader.batch.history_empty_hint": "开始批量评估后将显示在此处",
    "grader.batch.history_count": "显示 {count} 条记录",
    "grader.batch.incomplete_tasks": "{count} 个未完成的任务可以续传",
    "grader.batch.view": "查看",
    "grader.batch.resume": "续传",
    "grader.batch.delete": "删除",
    "grader.batch.back_to_history": "返回历史",
    "grader.batch.task_not_found": "未找到任务",
    "grader.batch.task_deleted": "任务 {task_id} 已删除",
    "grader.batch.delete_failed": "删除任务失败",
    # Batch - Result Panel
    "grader.batch.result_title": "评估结果",
    "grader.batch.summary": "摘要",
    "grader.batch.total_records": "总记录数",
    "grader.batch.export_results": "导出结果",
    "grader.batch.export_json": "导出 JSON",
    "grader.batch.export_csv": "导出 CSV",
    "grader.batch.score_distribution": "分数分布",
    "grader.batch.detailed_results": "详细结果",
    # Batch - Resume
    "grader.batch.resume_warning": "要续传任务，请先在侧边栏配置 API 密钥。",
    "grader.batch.resume_api_required": "需要 API 密钥才能续传评估，请在侧边栏配置。",
    "grader.batch.resuming": "正在续传任务：{task_id}...",
    "grader.batch.resuming_status": "正在续传批量评估...",
    "grader.batch.resume_complete": "续传完成！",
    "grader.batch.resume_failed": "续传任务失败，检查点可能已损坏。",
    # Help - Quick Guide
    "grader.help.title": "快速入门",
    "grader.help.single_title": "单条评估",
    "grader.help.single_step1": "在侧边栏配置 API 端点和密钥",
    "grader.help.single_step2": "选择评估器类别和具体评估器",
    "grader.help.single_step3": "输入评估数据（问题、回答等）",
    "grader.help.single_step4": "点击「运行评估」查看结果",
    "grader.help.batch_title": "批量评估",
    "grader.help.batch_step1": "配置 API 并选择评估器（同上）",
    "grader.help.batch_step2": "上传包含评估数据的 JSON 或 CSV 文件",
    "grader.help.batch_step3": "点击「开始批量评估」",
    "grader.help.batch_step4": "查看结果并导出（支持断点续传）",
    # Help - Data Format
    "grader.help.format_title": "数据格式说明",
    "grader.help.json_format": "JSON 格式",
    "grader.help.csv_format": "CSV 格式",
    "grader.help.agent_note": "注意：Agent 评估器的复杂字段需要使用 JSON 格式。",
    "grader.help.multimodal_note": "多模态评估器不支持批量评估。",
    # Error messages
    "grader.error.no_data": "没有可评估的数据",
    "grader.error.evaluation_failed": "错误：{error}",
}
