♻️ refactor: Convert glossary from JSON to Markdown table format (#11237)

* ♻️ refactor: Convert glossary from JSON to Markdown table format

- Migrate glossary.json to docs/glossary.md with table format
- Update .i18nrc.js to read glossary from Markdown file
- Add more terminology entries (agentGroup, thread)
- Improve readability with structured table layout

* update i18n

* update glossary

* 🐛 fix: fix file type
This commit is contained in:
Arvin Xu
2026-01-05 23:33:55 +08:00
committed by GitHub
parent 49ec5edffb
commit 46a58a83a1
7 changed files with 28 additions and 17 deletions

View File

@@ -1,4 +1,6 @@
const { defineConfig } = require('@lobehub/i18n-cli');
const fs = require('fs');
const path = require('path');
module.exports = defineConfig({
entry: 'locales/en-US',
@@ -31,8 +33,8 @@ module.exports = defineConfig({
},
markdown: {
reference:
'你需要保持 mdx 的组件格式,输出文本不需要在最外层包裹任何代码块语法。以下是一些词汇的固定翻译:\n' +
JSON.stringify(require('./glossary.json'), null, 2),
'你需要保持 mdx 的组件格式,输出文本不需要在最外层包裹任何代码块语法。\n' +
fs.readFileSync(path.join(__dirname, 'docs/glossary.md'), 'utf-8'),
entry: ['./README.zh-CN.md', './contributing/**/*.zh-CN.md', './docs/**/*.zh-CN.mdx'],
entryLocale: 'zh-CN',
outputLocales: ['en-US'],

11
docs/glossary.md Normal file
View File

@@ -0,0 +1,11 @@
# Glossary
以下是一些词汇的固定翻译:
| develop key | zh-CN(中文) | en-US(English) |
|-------------| ----------- | -------------- |
| agent | 助理 | Agent |
| agentGroup | 群组 | Group |
| page | 文稿 | Page |
| topic | 话题 | Topic |
| thread | 子话题 | Thread |

View File

@@ -1,8 +0,0 @@
{
"助理": {
"en-US": "Agent"
},
"文稿": {
"en-US": "Page"
}
}

View File

@@ -1,11 +1,11 @@
{
"actions.addNewTopic": "开启新话题",
"actions.autoRename": "智能重命名",
"actions.confirmRemoveAll": "您即将删除所有题,此操作无法撤销。",
"actions.confirmRemoveTopic": "您即将删除此题,此操作无法撤销。",
"actions.confirmRemoveUnstarred": "您即将删除未加星标的题,此操作无法撤销。",
"actions.confirmRemoveAll": "您即将删除所有题,此操作无法撤销。",
"actions.confirmRemoveTopic": "您即将删除此题,此操作无法撤销。",
"actions.confirmRemoveUnstarred": "您即将删除未加星标的题,此操作无法撤销。",
"actions.duplicate": "复制",
"actions.export": "导出题",
"actions.export": "导出题",
"actions.import": "导入对话",
"actions.openInNewWindow": "打开独立窗口",
"actions.removeAll": "删除全部话题",
@@ -24,7 +24,7 @@
"groupTitle.byTime.week": "本周",
"groupTitle.byTime.yesterday": "昨天",
"guide.desc": "点击发送左侧按钮可将当前会话保存为历史话题,并开启新一轮会话",
"guide.title": "题列表",
"guide.title": "题列表",
"importError": "导入遇到了问题",
"importInvalidFormat": "文件格式不正确。请确认这是有效的 JSON 文件",
"importLoading": "正在导入对话…",

View File

@@ -24,6 +24,8 @@ export const notebookRouter = router({
content: z.string(),
description: z.string(),
metadata: z.record(z.string(), z.any()).optional(),
source: z.string().optional().default('notebook'),
sourceType: z.enum(['file', 'web', 'api', 'topic']).optional().default('api'),
title: z.string(),
topicId: z.string(),
type: z
@@ -39,8 +41,8 @@ export const notebookRouter = router({
description: input.description,
fileType: input.type,
metadata: input.metadata,
source: 'notebook',
sourceType: 'api',
source: input.source,
sourceType: input.sourceType,
title: input.title,
totalCharCount: input.content.length,
totalLineCount: input.content.split('\n').length,

View File

@@ -8,6 +8,8 @@ interface CreateDocumentParams {
content: string;
description: string;
metadata?: Record<string, any>;
source?: string;
sourceType?: 'file' | 'web' | 'api' | 'topic';
title: string;
topicId: string;
type?: ExtendedDocumentType;

View File

@@ -130,6 +130,8 @@ class WebBrowsingExecutor extends BaseExecutor<typeof WebBrowsingApiName> {
const document = await notebookService.createDocument({
content: pageData.content,
description: pageData.description || `Crawled from ${pageData.url}`,
source: pageData.url,
sourceType: 'web',
title: pageData.title || pageData.url,
topicId: ctx.topicId!,
type: 'article',