import { getCache } from '@src/utils/cacheUtils'; type ENV = 'zh' | 'en'; const zhKeyMap = { titleHint: '标题', contextHint: '正文', normal: '普通文本', heading: '标题', heading1: '1 级标题', heading2: '2 级标题', heading3: '3 级标题', heading4: '4 级标题', heading5: '5 级标题', heading6: '6 级标题', softEnter: '软回车', bold: '加粗', strikethrough: '删除线', fontColor: '字体颜色', colorAndLingth: '颜色和高亮', bgColor: '背景颜色', numberedList: '有序列表', bulletedList: '无序列表', toDoList: '任务列表', link: '链接', quote: '引用', underline: '下划线', italic: '斜体', code: '代码', callout: '高亮块', codeBlock: '代码块', alignLeft: '左对齐', alignCenter: '居中对齐', alignRight: '右对齐', addComment: '添加评论', cut: '剪切', copy: '复制', delete: '删除', insert: '插入', table: '表格', copyTable: '复制表格', deleteTable: '删除表格', localFile: '本地文件', divider: '分隔线', fontSize: '字号', fontLetter: '字间距', increaseFontSize: '字体变大', decreaseFontSize: '字体变小', share: '分享', decreaseIndentation: '减少缩进', increaseIndentation: '增加缩进', historyVersion: '历史版本', showOutline: '显示目录', hideOutline: '隐藏目录', outlineSetting: '目录设置', showBorder: '显示边框', hideBorder: '隐藏边框', tableCellBg: '单元格背景颜色', lineHeight: '行高', default: '默认', alignmentHorizontal: '水平对齐', alignmentVertical: '垂直对齐', alignTop: '顶部对齐', alignMiddle: '垂直对齐', alignBottom: '底部对齐', format: '格式', paintFormat: '格式刷', cleanFormatting: '清除样式', undo: '撤销', redo: '重做', save: '保存', video: '视频', image: '图片', common: '通用', tableSize: '表格大小', tableInsertRow: '插入行', tableInsertColumn: '插入列', tableInsertUp: '向上插入 1 行', tableInsertDown: '向下插入 1 行', tableInsertLeft: '向左插入 1 列', tableInsertRight: '向右插入 1 列', tableDeleteSelectedRow: '删除行', tableDeleteSelectedColumn: '删除列', tableDelete: '删除表格', tableMerge: '合并单元格', tableUnmerge: '拆分单元格', hide: '隐藏', show: '显示', documentOutline: '目录', deepestAnchorLevel: '最深显示层级', reply: '回复', ReplyTo: '回复', edit: '编辑', submit: '提交', commentHasBeenDeleted: '评论已被删除', cancel: '取消', jumpToAnchor: '跳转到原文', anchorNotFound: '无法跳转,原文内容已丢失', globalComment: '全局评论', comment: '评论', visitLink: '访问链接', cancelLink: '取消链接', editLink: '编辑链接', complete: '完成', linkHint: '请添加链接地址', textHint: '请添加链接描述', text: '文本', moreFeatures: '更多功能', name: '姓名', email: '邮箱', empcode: '工号', department: '部门', positionname: '职位', download: '下载', space: '空格', quickGuide: '快捷指南', hotkey: '快捷键', globalHotkey: '全局快捷键', textHotkey: '文本快捷键', problemFeedback: '问题反馈', toTop: '回到顶部', emptyAnchorPlaceholder1: '对文档内容应用“标题”样式', emptyAnchorPlaceholder2: '即可生成“目录”', expandAnchor: '展开目录', collapseAnchor: '收起目录', helpCenter: '帮助中心', dragHandle: '长按拖拽', excalidraw: '画图工具', kirby: '卡比视觉稿', sCode: 'Trip代码沙盒', slides: 'PPT 模式', historyRecord: '文档历史记录', versionId: '版本号', versionName: '版本号', createTime: '创建时间', restore_doc: '恢复该版本', restore_doc_success: '恢复成功', returnToDoc: '返回文档', restore: '恢复', importantNotice: '重要提示', recoverVersionConfirm: '恢复该版本将会覆盖当前文档,是否继续?', currentVersion: '当前版本', uploadFailed: '上传失败', pleaseInputMarkdown: '开始用 Markdown 进行写作...', pleaseInputCode: '请输入代码...', zoomIn: '放大', }; const enKeyMap = { titleHint: 'Enter title here', contextHint: 'Type here', normal: 'Normal', heading: 'Heading', heading1: 'Heading 1', heading2: 'Heading 2', heading3: 'Heading 3', heading4: 'Heading 4', heading5: 'Heading 5', heading6: 'Heading 6', softEnter: 'Soft enter', bold: 'Bold', strikethrough: 'Strikethrough', fontColor: 'Text color', colorAndLingth: 'Color and highlights', bgColor: 'Background color', numberedList: 'Numbered list', bulletedList: 'Bulleted list', toDoList: 'To-do list', link: 'Link', quote: 'Quote', underline: 'Underline', italic: 'Italic', code: 'Code', callout: 'Callout', codeBlock: 'Code block', alignLeft: 'Left align', alignCenter: 'Center align', alignRight: 'Right align', addComment: 'Add comment', cut: 'Cut', copy: 'Copy', delete: 'Delete', insert: 'Insert', table: 'Table', copyTable: 'Copy Table', deleteTable: 'Delete Table', localFile: 'Local file', divider: 'Divider', fontSize: 'Font size', fontLetter: 'Font letter spacing', increaseFontSize: 'Increase font size', decreaseFontSize: 'Decrease font size', share: 'Share', decreaseIndentation: 'Decrease indentation', increaseIndentation: 'Increase indentation', historyVersion: 'History version', showOutline: 'Show document outline', hideOutline: 'Hide document outline', outlineSetting: 'Outline setting', showBorder: 'Show border', hideBorder: 'Hide border', tableCellBg: 'Table Cell Backgroud', lineHeight: 'Line height', default: 'default', alignmentHorizontal: 'Horizontal alignment', alignmentVertical: 'Vertical alignment', alignTop: 'Align top', alignMiddle: 'Align middle', alignBottom: 'Align bottom', format: 'Styles', paintFormat: 'Paint format', cleanFormatting: 'Clean formatting', undo: 'Undo', redo: 'Redo', save: 'Save', video: 'Video', image: 'Image', common: 'Common', tableSize: 'Table size', tableInsertRow: 'Insert row', tableInsertColumn: 'Insert column', tableInsertUp: 'Insert row above', tableInsertDown: 'Insert row below', tableInsertLeft: 'Insert column to the left', tableInsertRight: 'Insert column to the right', tableDeleteSelectedRow: 'Delete selected row', tableDeleteSelectedColumn: 'Delete selected column', tableDelete: 'Delete table', tableMerge: 'Merge cells', tableUnmerge: 'Unmerge cells', hide: 'Hide', show: 'Show', documentOutline: 'Outline', deepestAnchorLevel: 'Deepest shown level', reply: 'Reply', replyTo: 'Reply to', edit: 'Edit', submit: 'Submit', commentHasBeenDeleted: 'Comment has been deleted', cancel: 'Cancel', jumpToAnchor: 'Jump to anchor', anchorNotFound: 'Fail to jump, the original anchor content has been modified', globalComment: 'Global comments', comment: 'Comment', visitLink: 'Visit link', cancelLink: 'Unlink', editLink: 'Edit link', complete: 'OK', linkHint: 'Paste or enter a link', textHint: 'Paste or enter a text', text: 'Text', moreFeatures: 'More features', name: 'Name', email: 'Email', empcode: 'Emp ID', department: 'Dept', positionname: 'Position', download: 'Download', space: 'Space', quickGuide: 'Quick guide', hotkey: 'Hotkey', globalHotkey: 'Global hotkey', textHotkey: 'Text hotkey', problemFeedback: 'Problem feedback', toTop: 'Back to top', emptyAnchorPlaceholder1: 'Apply "Heading" style to the content', emptyAnchorPlaceholder2: 'to generate document "Outline"', expandAnchor: 'Expand outline', collapseAnchor: 'Collapse outline', helpCenter: 'Help center', dragHandle: 'Hold to drag', excalidraw: 'Diagram', kirby: 'kirby design', sCode: 'TripSandBox', slides: 'Slides model', historyRecord: 'Document history records', versionId: 'Version ID', versionName: 'Version name', restore_doc: 'Restore document', restore_doc_success: 'Restored successfully', returnToDoc: 'Return to document', restore: 'Restore', importantNotice: 'Important notice', recoverVersionConfirm: 'Are you sure to recover this version?', currentVersion: 'Current Version', uploadFailed: 'Upload failed', pleaseInputMarkdown: 'Start writing in Markdown...', pleaseInputCode: 'Start writing some code...', zoomIn: 'Zoom in', }; export function getStringResource(key, env: ENV = 'zh'): string { if (env === 'zh') { return zhKeyMap[key]; } return enKeyMap[key]; } export function f(key, env: ENV = 'zh'): string { return getStringResource(key, window?.tripdocs?.lang || env); }