Skip to content

Commit 2f4cd56

Browse files
committed
feat: update translate prompt
1 parent def02c5 commit 2f4cd56

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

packages/translate/src/openai.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ General rules:
6666
- URLs and file paths
6767
• Maintain the original paragraph structure and heading levels
6868
69-
⚠️ CRITICAL MDX FRONTMATTER RULE ⚠️
69+
⚠️ CRITICAL MDX FRONTMATTER RULES ⚠️
7070
• NEVER start a frontmatter value with inline code (text between \`backticks\`)
7171
• This applies to ALL inline code including \`<Component>\` tags, \`functions\`, variables, etc.
7272
• In frontmatter (sections between --- marks), ALWAYS rearrange sentences so inline code appears AFTER some text
73-
• This is ABSOLUTELY REQUIRED for proper rendering of the documentation
73+
• ALWAYS preserve both the opening and closing frontmatter delimiters (---) - never omit the closing delimiter
74+
• Maintain the exact structure of frontmatter - beginning with ---, followed by key-value pairs, and ending with ---
75+
• These rules are ABSOLUTELY REQUIRED for proper rendering of the documentation
7476
7577
Examples of MDX Frontmatter Translation:
7678
@@ -100,8 +102,33 @@ Examples of MDX Frontmatter Translation:
100102
Translation:
101103
description: \`<Link>\` 组件的 API 参考文档。
102104
103-
This rule applies ONLY to frontmatter (between --- marks) and is CRITICAL for proper document rendering.
104-
REMEMBER: You must NEVER start with inline code in frontmatter values.
105+
# Example 3: Frontmatter Structure
106+
✓ CORRECT (Always do this):
107+
Original:
108+
---
109+
title: Link
110+
description: API reference for the \`<Link>\` component.
111+
---
112+
Translation:
113+
---
114+
title: Link
115+
description: 关于 \`<Link>\` 组件的 API 参考文档。
116+
---
117+
118+
✗ INCORRECT (Never do this):
119+
Original:
120+
---
121+
title: Link
122+
description: API reference for the \`<Link>\` component.
123+
---
124+
Translation:
125+
---
126+
title: Link
127+
description: 关于 \`<Link>\` 组件的 API 参考文档。
128+
(missing closing delimiter)
129+
130+
These rules apply ONLY to frontmatter (between --- marks) and are CRITICAL for proper document rendering.
131+
REMEMBER: You must NEVER start with inline code in frontmatter values and ALWAYS include both opening and closing --- delimiters.
105132
106133
Output format:
107134
• Provide only the translated content

0 commit comments

Comments
 (0)