export type Locale = 'zh' | 'en' const dictionaries = { zh: { app: { name: 'real2sim 平台', subtitle: 'Tripo H3.1 资产生成与柔性仿真工作台', apiReady: 'API 已配置', apiMissing: 'API 未配置', language: '语言', refresh: '刷新', }, tabs: { generation: '模型生成', flex: '柔性物体', library: '资产库', }, generation: { title: 'Tripo 3D 生成', mode: '输入方式', text: '文本', image: '单图', multiImage: '多图', prompt: '提示词', promptPlaceholder: '例如:一只带有工业传感器的柔性机器人夹爪', imageUrl: '公网图片 URL', imagePlaceholder: 'https://example.com/object.png', front: '前视图', left: '左视图', back: '后视图', right: '右视图', model: '模型', textureQuality: '贴图质量', geometryQuality: '几何精度', standard: '标准', detailed: '高清', ultra: '超清', pbr: 'PBR 材质', texture: '生成贴图', generate: '创建任务', generating: '提交中', noTexture: '无贴图', }, flex: { title: '柔性物体生成', source: '源资产', sourceModelUrl: '源 GLB', sourcePrompt: '源描述', behavior: '柔性目标', behaviorPlaceholder: '保持原始轮廓,变成可压缩、可弯曲、适合仿真的柔性版本', material: '材料类型', silicone: '软硅胶', cloth: '织物', inflatable: '充气膜', softRobot: '软体机器人', elasticity: '弹性', damping: '阻尼', thickness: '厚度 mm', deformation: '最大形变', gravity: '重力', generate: '生成柔性版本', export: '导出仿真配置', chooseSource: '从资产库选择', }, library: { title: '资产库', empty: '暂无任务', useForFlex: '作为柔性源', openModel: '打开 GLB', openImage: '打开预览', createdAt: '创建时间', }, task: { title: '任务结果', current: '当前任务', taskId: '任务 ID', requestId: '请求 ID', status: '状态', noTask: '尚未创建任务', poll: '查询状态', downloadPbr: '下载 PBR GLB', downloadBase: '下载基础 GLB', rendered: '渲染预览', pending: '排队中', running: '处理中', succeeded: '成功', failed: '失败', canceled: '已取消', unknown: '未知', }, viewport: { label: '3D 预览', modelReady: '模型链接已生成', preview: '软体预览', idle: '等待生成', }, timeline: { title: '任务时间线', empty: '暂无历史任务', }, errors: { generic: '请求失败', validation: '请检查输入', }, }, en: { app: { name: 'real2sim Platform', subtitle: 'Tripo H3.1 asset generation and soft simulation workbench', apiReady: 'API configured', apiMissing: 'API missing', language: 'Language', refresh: 'Refresh', }, tabs: { generation: 'Model Generation', flex: 'Flexible Object', library: 'Asset Library', }, generation: { title: 'Tripo 3D Generation', mode: 'Input Mode', text: 'Text', image: 'Single Image', multiImage: 'Multi Image', prompt: 'Prompt', promptPlaceholder: 'Example: a flexible robot gripper with industrial sensors', imageUrl: 'Public Image URL', imagePlaceholder: 'https://example.com/object.png', front: 'Front', left: 'Left', back: 'Back', right: 'Right', model: 'Model', textureQuality: 'Texture Quality', geometryQuality: 'Geometry Quality', standard: 'Standard', detailed: 'Detailed', ultra: 'Ultra', pbr: 'PBR material', texture: 'Texture', generate: 'Create Task', generating: 'Submitting', noTexture: 'Untextured', }, flex: { title: 'Flexible Object Generation', source: 'Source Asset', sourceModelUrl: 'Source GLB', sourcePrompt: 'Source Description', behavior: 'Soft Target', behaviorPlaceholder: 'Preserve the original silhouette as a compressible, bendable simulation-ready variant', material: 'Material', silicone: 'Silicone', cloth: 'Cloth', inflatable: 'Inflatable', softRobot: 'Soft Robot', elasticity: 'Elasticity', damping: 'Damping', thickness: 'Thickness mm', deformation: 'Max Deformation', gravity: 'Gravity', generate: 'Generate Soft Variant', export: 'Export Simulation Profile', chooseSource: 'Choose from Library', }, library: { title: 'Asset Library', empty: 'No tasks yet', useForFlex: 'Use as Flex Source', openModel: 'Open GLB', openImage: 'Open Preview', createdAt: 'Created', }, task: { title: 'Task Result', current: 'Current Task', taskId: 'Task ID', requestId: 'Request ID', status: 'Status', noTask: 'No task yet', poll: 'Query Status', downloadPbr: 'Download PBR GLB', downloadBase: 'Download Base GLB', rendered: 'Rendered Preview', pending: 'Pending', running: 'Running', succeeded: 'Succeeded', failed: 'Failed', canceled: 'Canceled', unknown: 'Unknown', }, viewport: { label: '3D Preview', modelReady: 'Model link generated', preview: 'Soft preview', idle: 'Waiting', }, timeline: { title: 'Task Timeline', empty: 'No history yet', }, errors: { generic: 'Request failed', validation: 'Check the input', }, }, } as const type WidenMessages = { readonly [K in keyof T]: T[K] extends string ? string : WidenMessages } export type Messages = WidenMessages export const messages: Record = dictionaries export function getInitialLocale(): Locale { if (typeof window === 'undefined') { return 'zh' } const saved = window.localStorage.getItem('real2sim.locale') return saved === 'en' ? 'en' : 'zh' }