const zh = { switchLanguage: '切换语言', backHome: '返回首页', switchToLight: '切换亮色模式', switchToDark: '切换暗色模式', myPlans: '我的计划', levelProgress: '升级进度: {current}/{needed} XP', logout: '退出', login: '登录', signUp: '注册', logIn: '登录', rights: '© {year} Goal Planner. 保留所有权利。', powered: '用 AI 把目标变成现实。', heroTitle: '把雄心变成行动', heroSubtitle: 'Goal Planner 用 AI 把你的大目标拆成可以执行的步骤。少空想,多行动。', createFirstPlan: '创建你的第一个计划', howItWorks: '怎么用', howItWorksSub: '三步就能把目标理清楚。', step1Title: '1. 写下目标', step1Body: '告诉 AI 你想达成什么,可以很概括,也可以很具体。', step2Title: '2. 生成计划', step2Body: '系统会分析你的目标,整理出带依赖关系的任务路线。', step3Title: '3. 执行并跟踪', step3Body: '按计划推进,勾选完成的任务,看着项目一点点落地。', testimonialsTitle: '他们正在用', testimonial1: '“这个工具改变了我的做法。一个模糊的创业想法,几分钟就变成了完整的项目计划。”', testimonial1Role: '创业者', testimonial2: '“同时赶好几个课业项目时,Goal Planner 帮我把事情理顺了。依赖关系看得特别清楚。”', testimonial2Role: '大学生', missionTitle: '我们的目标', missionBody: '好想法不该卡在怎么落地。Goal Planner 想补上愿景和现实之间的缺口,让做事的人有清晰的结构和持续的推进感。', ctaTitle: '准备好拿下你的目标了吗?', ctaBody: '别再拖了,先把计划列出来。下一次真正做成的事,可能就差这几下点击。', ctaButton: '免费开始', welcomeTitle: '欢迎回来', loginSubtitle: '登录后查看你的计划。', email: '邮箱', password: '密码', noAccount: '还没有账号?', createAccount: '创建账号', signupSubtitle: '从今天开始规划你的目标。', fullName: '姓名', namePlaceholder: '你的名字', hasAccount: '已经有账号?', nextGoalTitle: '下一个伟大目标是什么?', nextGoalSub: '描述你想完成的事,我们来拆步骤。', goalPlaceholder: '例如:做一个分享烹饪的个人博客', collapseExtra: '收起', importPlan: '导入计划(Markdown)', importPlaceholder: '粘贴从其他 AI 或工具生成的任务计划(支持 Markdown),AI 将据此生成结构化任务列表。\n\n例如:\n## 阶段一:需求分析\n- 用户调研\n- 竞品分析\n\n## 阶段二:开发\n- 前端开发\n- 后端开发', importReady: '已导入计划,AI 会据此生成结构化任务', generatePlan: '生成我的计划', orTryExample: '也可以试试这些例子:', exampleTrip: '规划旅行', exampleTripGoal: '规划一次为期两周的东南亚背包旅行', exampleSkill: '学一项技能', exampleSkillGoal: '用 3 个月学会弹吉他', exampleProduct: '发布一个产品', exampleProductGoal: '做出并发布一个简单的 SaaS 产品', yourGoal: '你的目标', newPlan: '新建计划', progress: '进度', tasksCount: '{done} / {total} 个任务', totalTime: '预计总时长:{hours} 小时', searchTasks: '搜索任务...', statusAll: '全部状态', statusTodo: '待办', statusDoing: '进行中', statusDone: '已完成', priorityAll: '全部优先级', priorityHigh: '高', priorityMedium: '中', priorityLow: '低', priorityHighFull: '高优先级', priorityMediumFull: '中优先级', priorityLowFull: '低优先级', actionPlan: '行动计划', noMatch: '没有匹配的任务', goodLuck: '加油 😊', congratsTitle: '🎉 恭喜完成所有任务!', congratsSub: '你已经完成了整个计划的所有任务', congratsStats: '总计 {total} 个任务 · 预估 {hours} 小时', congratsBtn: '太棒了!', loadPlansFail: '加载计划失败', deletePlanConfirm: '确定要删除此计划吗?', planDeleted: '计划已删除', deletePlanFail: '删除计划失败', loadPlanFail: '加载计划失败', loadingPlans: '正在加载你的计划...', planCount: '{count} 个计划', statusNotStarted: '未开始', emptyPlansTitle: '还没有计划', emptyPlansSub: '创建你的第一个 AI 计划吧!', createFirst: '创建第一个计划', tasksDone: '{done} / {total} 个任务已完成', deletePlan: '删除计划', welcomeBack: '欢迎回来,{name}!', signupSuccess: '注册成功!', preparing: '准备中...', planReady: '计划生成成功!', unknownError: '发生了未知错误。', levelUp: '🎉 升级了!Lv.{old} → Lv.{next}', allDoneBonus: '🏆 所有任务完成!获得 {xp} XP 奖励!', taskUpdated: '任务已更新', taskDeleted: '任务已删除', taskAdded: '任务已添加', reorderFail: '排序更新失败', oops: '出错了', tryAgain: '再试一次', loading: '加载中...', generating: '正在用 AI 生成你的计划...', generatingTitle: 'AI 正在为你制定计划', stepAnalyzing: '分析目标', stepConnecting: '连接模型', stepGenerating: '生成计划', stepParsing: '解析响应', stepSaving: '保存数据', stepBuilding: '构建任务', depLockedToast: '子任务依赖未完成,暂不可操作', expand: '展开子任务', collapse: '折叠子任务', depLocked: '子任务依赖未完成', autoDone: '所有子任务已完成,自动标记完成', finishChildrenFirst: '请先完成所有子任务', needDeps: '需先完成依赖任务', today: '今天', inProgress: '进行中', dependsOn: '依赖:', childSummary: '{done}/{total} 子任务 · 完成后自动标记', addSibling: '添加同级任务', addChild: '添加子任务', editTask: '编辑任务', deleteTask: '删除任务', confirmDelete: '确认删除', deleteTaskConfirm: '确定要删除任务 “{title}” 吗?', deleteChildrenToo: '将同时删除所有子任务', cancel: '取消', delete: '删除', finishChildrenTip: '先完成所有子任务,父级任务将自动标记完成', close: '关闭', title: '标题', description: '描述', durationHours: '预估工时(小时)', parentTaskHint: '(父任务)', priority: '优先级', dueDate: '截止日期', dependencies: '依赖', selectDeps: '选择依赖任务...', noTasks: '暂无可选任务', saveChanges: '保存修改', addChildTitle: '添加子任务', addSiblingTitle: '添加同级任务', addChildHint: '在 “{title}” 下添加子任务', addSiblingHint: '与 “{title}” 同级添加任务', belongsTo: '归属于', rootLevel: '根级', taskId: '任务 ID', taskIdPlaceholder: '如 phase-2-design(留空自动生成)', titlePlaceholder: '任务标题', descPlaceholder: '任务描述', durationPlaceholder: '如 4', addTask: '添加任务', encourageHigh1: '太棒了!你攻克了最难的一关!🔥', encourageHigh2: '出色的工作!高难度任务也难不倒你!💪', encourageHigh3: '了不起!挑战完成了,你是最强的!⭐', encourageHigh4: '征服高难度任务的感觉真好!继续保持!🎯', encourageMid1: '干得漂亮!稳步前进中!🚀', encourageMid2: '出色的工作!继续保持这个节奏!✨', encourageMid3: '又完成了一项!你正在不断进步!🌟', encourageMid4: '很棒!一步一个脚印,离目标更近了!👏', encourageLow1: '轻松搞定!积少成多!💧', encourageLow2: '完成啦!每一个小任务都算数!🌱', encourageLow3: '搞定!小胜利也是胜利!🎯', encourageLow4: '又一步完成了!保持节奏!😊', levelPhase: '阶段', levelTask: '任务', levelSubtask: '子任务', levelDone: '{label}完成', completed: '已完成', keepGoing: '继续前进', registerFail: '注册失败', loginFail: '登录失败', notAuthenticated: '尚未登录', generateFail: '生成计划失败', streamUnsupported: '当前浏览器不支持流式响应', noResult: '服务器没有返回结果', fetchPlansFail: '获取计划列表失败', fetchPlanFail: '获取计划失败', updateTaskFail: '更新任务失败', createTaskFail: '创建任务失败', deleteTaskFail: '删除任务失败', updateStatusFail: '更新任务状态失败', }; const en: Record = { switchLanguage: 'Switch language', backHome: 'Back to home', switchToLight: 'Switch to light mode', switchToDark: 'Switch to dark mode', myPlans: 'My Plans', levelProgress: 'Level progress: {current}/{needed} XP', logout: 'Logout', login: 'Login', signUp: 'Sign Up', logIn: 'Log In', rights: '© {year} Goal Planner. All rights reserved.', powered: 'Powered by AI to make your goals a reality.', heroTitle: 'Turn Ambition into Action', heroSubtitle: 'Goal Planner uses AI to break down your biggest goals into a manageable, step-by-step plan. Stop wondering, start doing.', createFirstPlan: 'Create Your First Plan', howItWorks: 'How It Works', howItWorksSub: 'Achieve clarity in three simple steps.', step1Title: '1. Define Your Goal', step1Body: 'Start by telling our AI what you want to achieve. Be as broad or specific as you like.', step2Title: '2. Generate Your Plan', step2Body: 'Our intelligent system analyzes your goal and creates a detailed roadmap with tasks and dependencies.', step3Title: '3. Execute & Track', step3Body: 'Follow the plan, mark tasks as complete, and watch your project come to life.', testimonialsTitle: 'Trusted by High-Achievers', testimonial1: '"This tool is a game-changer. I went from a vague idea for my startup to a full-fledged project plan in minutes. Unbelievable!"', testimonial1Role: 'Entrepreneur', testimonial2: '"As a student juggling multiple projects, the Goal Planner brought much-needed clarity. The dependency mapping is pure genius."', testimonial2Role: 'University Student', missionTitle: 'Our Mission', missionBody: 'We believe that great ideas shouldn\'t get lost in the complexity of execution. Goal Planner was born to bridge the gap between vision and reality, and to give creators clarity, structure, and momentum.', ctaTitle: 'Ready to Conquer Your Goals?', ctaBody: 'Stop procrastinating and start planning. Your next big achievement is just a few clicks away.', ctaButton: 'Get Started for Free', welcomeTitle: 'Welcome Back!', loginSubtitle: 'Log in to access your plans.', email: 'Email Address', password: 'Password', noAccount: "Don't have an account?", createAccount: 'Create Your Account', signupSubtitle: 'Start planning your goals today.', fullName: 'Full Name', namePlaceholder: 'Ada Lovelace', hasAccount: 'Already have an account?', nextGoalTitle: "What's Your Next Big Goal?", nextGoalSub: "Describe what you want to accomplish, and we'll map out the steps.", goalPlaceholder: 'e.g., Launch a new personal blog about cooking', collapseExtra: 'Hide', importPlan: 'Import Plan (Markdown)', importPlaceholder: 'Paste a task plan from another AI or tool (Markdown supported). AI will turn it into a structured task list.\n\nExample:\n## Phase 1: Research\n- User interviews\n- Competitor analysis\n\n## Phase 2: Build\n- Frontend\n- Backend', importReady: 'Plan imported. AI will generate structured tasks from it.', generatePlan: 'Generate My Plan', orTryExample: 'Or try an example:', exampleTrip: 'Plan a trip', exampleTripGoal: 'Plan a 2-week backpacking trip through Southeast Asia', exampleSkill: 'Learn a skill', exampleSkillGoal: 'Learn to play the guitar in 3 months', exampleProduct: 'Launch a product', exampleProductGoal: 'Build and launch a simple SaaS product', yourGoal: 'Your Goal', newPlan: 'New Plan', progress: 'Progress', tasksCount: '{done} / {total} Tasks', totalTime: 'Total estimated time: {hours} hours', searchTasks: 'Search tasks...', statusAll: 'All statuses', statusTodo: 'To do', statusDoing: 'In progress', statusDone: 'Done', priorityAll: 'All priorities', priorityHigh: 'High', priorityMedium: 'Med', priorityLow: 'Low', priorityHighFull: 'High priority', priorityMediumFull: 'Medium priority', priorityLowFull: 'Low priority', actionPlan: 'Your Action Plan', noMatch: 'No matching tasks', goodLuck: 'Good Luck 😊', congratsTitle: '🎉 All tasks complete!', congratsSub: 'You finished every task in this plan.', congratsStats: '{total} tasks · about {hours} hours', congratsBtn: 'Awesome!', loadPlansFail: 'Failed to load plans', deletePlanConfirm: 'Delete this plan?', planDeleted: 'Plan deleted', deletePlanFail: 'Failed to delete plan', loadPlanFail: 'Failed to load plan', loadingPlans: 'Loading your plans...', planCount: '{count} plans', statusNotStarted: 'Not started', emptyPlansTitle: 'No plans yet', emptyPlansSub: 'Create your first AI-powered plan.', createFirst: 'Create your first plan', tasksDone: '{done} / {total} tasks done', deletePlan: 'Delete plan', welcomeBack: 'Welcome back, {name}!', signupSuccess: 'Account created!', preparing: 'Getting ready...', planReady: 'Plan created!', unknownError: 'An unknown error occurred.', levelUp: '🎉 Level up! Lv.{old} → Lv.{next}', allDoneBonus: '🏆 All tasks done! +{xp} XP bonus!', taskUpdated: 'Task updated', taskDeleted: 'Task deleted', taskAdded: 'Task added', reorderFail: 'Could not update order', oops: 'Oops! Something went wrong.', tryAgain: 'Try Again', loading: 'Loading...', generating: 'Generating your plan with AI...', generatingTitle: 'AI is building your plan', stepAnalyzing: 'Analyze', stepConnecting: 'Connect', stepGenerating: 'Generate', stepParsing: 'Parse', stepSaving: 'Save', stepBuilding: 'Build', depLockedToast: 'A subtask dependency is still unfinished', expand: 'Expand subtasks', collapse: 'Collapse subtasks', depLocked: 'A subtask dependency is unfinished', autoDone: 'All subtasks are done, so this task is complete', finishChildrenFirst: 'Finish all subtasks first', needDeps: 'Finish the dependencies first', today: 'Today', inProgress: 'In progress', dependsOn: 'Depends on:', childSummary: '{done}/{total} subtasks · completes automatically', addSibling: 'Add sibling task', addChild: 'Add subtask', editTask: 'Edit task', deleteTask: 'Delete task', confirmDelete: 'Delete task', deleteTaskConfirm: 'Delete “{title}”?', deleteChildrenToo: 'All subtasks will be deleted too', cancel: 'Cancel', delete: 'Delete', finishChildrenTip: 'Finish every subtask and the parent task will be marked done', close: 'Close', title: 'Title', description: 'Description', durationHours: 'Estimated hours', parentTaskHint: '(parent task)', priority: 'Priority', dueDate: 'Due date', dependencies: 'Dependencies', selectDeps: 'Select dependencies...', noTasks: 'No tasks to select', saveChanges: 'Save changes', addChildTitle: 'Add subtask', addSiblingTitle: 'Add sibling task', addChildHint: 'Add a subtask under “{title}”', addSiblingHint: 'Add a task beside “{title}”', belongsTo: 'Under', rootLevel: 'Top level', taskId: 'Task ID', taskIdPlaceholder: 'e.g. phase-2-design (optional)', titlePlaceholder: 'Task title', descPlaceholder: 'Task description', durationPlaceholder: 'e.g. 4', addTask: 'Add task', encourageHigh1: 'You just cleared the hardest one! 🔥', encourageHigh2: 'Tough task, still done. Nice work! 💪', encourageHigh3: 'Challenge complete. That was strong! ⭐', encourageHigh4: 'Hard tasks look good on you. Keep going! 🎯', encourageMid1: 'Clean work. Keep the pace! 🚀', encourageMid2: 'Another one down. Stay in rhythm! ✨', encourageMid3: 'You are moving forward! 🌟', encourageMid4: 'One solid step closer to the goal! 👏', encourageLow1: 'Easy win. Small steps add up! 💧', encourageLow2: 'Done! Every small task counts! 🌱', encourageLow3: 'Checked off. A small win is still a win! 🎯', encourageLow4: 'One more step. Keep the rhythm! 😊', levelPhase: 'Phase', levelTask: 'Task', levelSubtask: 'Subtask', levelDone: '{label} done', completed: 'Done', keepGoing: 'Keep going', registerFail: 'Registration failed', loginFail: 'Login failed', notAuthenticated: 'Not authenticated', generateFail: 'Failed to generate plan', streamUnsupported: 'ReadableStream is not supported', noResult: 'No result received from server', fetchPlansFail: 'Failed to fetch plans', fetchPlanFail: 'Failed to fetch plan', updateTaskFail: 'Failed to update task', createTaskFail: 'Failed to create task', deleteTaskFail: 'Failed to delete task', updateStatusFail: 'Failed to update task status', }; export type Lang = 'zh' | 'en'; export type MessageKey = keyof typeof zh; export const translations: Record> = { zh, en }; export function currentText(key: MessageKey): string { const saved = localStorage.getItem('lang'); const lang: Lang = saved === 'en' || saved === 'zh' ? saved : (navigator.language.toLowerCase().startsWith('zh') ? 'zh' : 'en'); return translations[lang][key]; }