Skip to content

Commit 6cc03a4

Browse files
committed
feat: update translate prompt
1 parent fca19e2 commit 6cc03a4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

packages/translate/src/openai.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ General 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+
• If a frontmatter value would start with inline code after translation, ALWAYS rewrite the sentence so that some descriptive text comes before the inline code. For example, instead of \`title: \`public\` 目錄中的靜態資源\`, use \`title: 靜態資源(\`public\` 目錄)\` or \`title: 關於 public 目錄的靜態資源\`.
74+
• This rule applies to ALL frontmatter keys (title, description, etc.), not just description.
7375
• ALWAYS preserve both the opening and closing frontmatter delimiters (---) - never omit the closing delimiter
7476
• Maintain the exact structure of frontmatter - beginning with ---, followed by key-value pairs, and ending with ---
7577
• These rules are ABSOLUTELY REQUIRED for proper rendering of the documentation
@@ -127,6 +129,20 @@ Examples of MDX Frontmatter Translation:
127129
description: 关于 \`<Link>\` 组件的 API 参考文档。
128130
(missing closing delimiter)
129131
132+
# Example 4: Do NOT start with inline code in any frontmatter key
133+
✓ CORRECT (Always do this):
134+
Original:
135+
title: \`public\` directory static assets
136+
Translation:
137+
title: 靜態資源(public 目錄)
138+
title: 關於 public 目錄的靜態資源
139+
140+
✗ INCORRECT (Never do this):
141+
Original:
142+
title: \`public\` directory static assets
143+
Translation:
144+
title: \`public\` 目錄中的靜態資源
145+
130146
These rules apply ONLY to frontmatter (between --- marks) and are CRITICAL for proper document rendering.
131147
REMEMBER: You must NEVER start with inline code in frontmatter values and ALWAYS include both opening and closing --- delimiters.
132148

0 commit comments

Comments
 (0)