Skip to content

Commit 56332a0

Browse files
committed
📖 改进提示词的内容格式
1 parent f100130 commit 56332a0

File tree

4 files changed

+20
-25
lines changed

4 files changed

+20
-25
lines changed

docs/.vitepress/i18n.mts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ export const i18n = (
3636
path.join(import.meta.dirname, `..${dirBase}help`),
3737
urlBase
3838
);
39-
if (urlBase !== "/") {
40-
console.log(
41-
"developerSlidbar",
42-
formatWithOptions({ depth: Infinity, colors: true }, developerSlidbar)
43-
);
44-
}
39+
4540
return {
4641
label: m.label,
4742
lang,

scripts/i18n-all.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,8 @@ if (importMeta.main) {
129129

130130
translateAll(zTranslateAllOptions.parse(args));
131131
}
132+
133+
/**
134+
* eg:
135+
* `node ./scripts/i18n-all.ts -l zh-Hans -l en`
136+
*/

scripts/i18n.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,6 @@ if (import_meta_ponyfill(import.meta).main) {
269269

270270
/**
271271
* eg:
272-
* `node .\scripts\i18n.ts -f .\docs\intro.md -f .\docs\en\intro.md -l zh-Hans -l en`
273-
* `node .\scripts\i18n.ts --mode increment -f .\docs\intro.md -f .\docs\en\intro.md -l zh-Hans -l en`
272+
* `node ./scripts/i18n.ts -f ./docs/intro.md -f ./docs/en/intro.md -l zh-Hans -l en`
273+
* `node ./scripts/i18n.ts --mode increment -f ./docs/intro.md -f ./docs/en/intro.md -l zh-Hans -l en`
274274
*/

scripts/system-prompt.zh.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
该工具提供两种工作模式:
66

7-
1. **全量翻译** - 完整文档转换
8-
2. **增量翻译** - 基于变更的本地化
7+
1. **全量翻译** - 完整文档翻译
8+
2. **增量翻译** - 按需进行局部翻译
99

1010
## 全量翻译的输入输出规范
1111

@@ -150,31 +150,26 @@
150150

151151
- Markdown:保留标题层级、代码块、列表结构、链接锚点
152152
- JSON:保持键名不变,仅翻译值(含转义字符处理)
153-
- 注释标记:保留 <!-- i18n-ignore --> 等标记的原始位置
153+
- 注释标记:保留 `<!-- i18n-ignore -->` 等标记的原始位置
154154
- capable of translating texts accurately into the specified target language,
155155
- preserving technical terms, code snippets, markdown formatting, and platform-specific language.
156156
- Do not add any explanations or annotations to the translated text.
157157

158158
2. 标记处理:
159-
• 忽略区块:
160-
<!-- i18n-ignore-start -->...<!-- i18n-ignore-end --> → 保持原样
161159

162-
• 本土化标记
163-
164-
<!-- i11n-start: {提示} -->...<!-- i11n-end -->
165-
166-
- 根据提示进行创意改编(如:中文成语 → 等效英文谚语)
167-
- 在翻译后添加 <!-- i11n-reason: 改编说明 -->
160+
- 忽略区块
161+
`<!-- i18n-ignore-start -->...<!-- i18n-ignore-end -->` → 保持原样
162+
- 本土化标记:
163+
`<!-- i11n-start: {提示} -->...<!-- i11n-end -->`
164+
- 根据提示进行创意改编(如:中文成语 → 等效英文谚语)
165+
- 在翻译后,在`<!-- i11n-end -->`前面添加 `<!-- i11n-reason: 改编说明 -->`
168166

169167
3. JSON 特殊字段:
170-
"//key": ["i18n-ignore"] → 跳过对应键值的翻译
171-
"//key": ["i11n: 提示"] → 按提示本地化翻译,保留原始键
172168

173-
4. 混合内容处理:
174-
[中文](原文) → [英文](翻译) // 保留注释
175-
"key": "值" // 保留行尾注释
169+
- "//key": ["i18n-ignore"] → 跳过对应键值的翻译
170+
- "//key": ["i11n: 提示"] → 按提示本地化翻译,保留原始键
176171

177-
5. 对于增量翻译模式,需要理解参数和返回值的含义:
172+
4. 对于增量翻译模式,需要理解参数和返回值的含义:
178173
- 首先是 changes 参数,它是指某一个文件的变更记录,使用`git diff`获得的差异信息
179174
- 然后是 files 参数,是指其它没有变更的文件。
180175
- 最后关于返回值 files,会有两种格式:

0 commit comments

Comments
 (0)