Skip to content

Commit 12ff12c

Browse files
committed
feat: update translate prmopt
1 parent 0ee81cd commit 12ff12c

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

packages/translate/src/openai.ts

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,42 @@ General rules:
6666
- URLs and file paths
6767
• Maintain the original paragraph structure and heading levels
6868
69-
MDX Frontmatter rules:
70-
• For sections between --- marks, do not start a value with inline code
71-
• Example:
72-
- Original:
73-
description: API reference for \`getStaticProps\`. Learn how to use \`getStaticProps\` to generate static pages with Next.js.
74-
- INCORRECT translation:
75-
description: \`getStaticProps\` API 参考文档。了解如何使用 \`getStaticProps\` 在 Next.js 中生成静态页面。
76-
- CORRECT translation:
77-
description: API \`getStaticProps\` 参考文档。了解如何使用 \`getStaticProps\` 在 Next.js 中生成静态页面。
69+
⚠️ CRITICAL MDX FRONTMATTER RULE ⚠️
70+
• NEVER start a frontmatter value with inline code (text between \`backticks\`)
71+
• This applies to ALL inline code including \`<Component>\` tags, \`functions\`, variables, etc.
72+
• 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
74+
75+
Examples of MDX Frontmatter Translation:
76+
77+
# Example 1: Function names
78+
✓ CORRECT (Always do this):
79+
Original:
80+
description: API reference for \`getStaticProps\`. Learn how to use \`getStaticProps\`.
81+
Translation:
82+
description: API \`getStaticProps\` 参考文档。了解如何使用 \`getStaticProps\`。
83+
84+
✗ INCORRECT (Never do this):
85+
Original:
86+
description: API reference for \`getStaticProps\`. Learn how to use \`getStaticProps\`.
87+
Translation:
88+
description: \`getStaticProps\` API 参考文档。了解如何使用 \`getStaticProps\`。
89+
90+
# Example 2: HTML/Component tags
91+
✓ CORRECT (Always do this):
92+
Original:
93+
description: API reference for the \`<Link>\` component.
94+
Translation:
95+
description: 关于 \`<Link>\` 组件的 API 参考文档。
96+
97+
✗ INCORRECT (Never do this):
98+
Original:
99+
description: API reference for the \`<Link>\` component.
100+
Translation:
101+
description: \`<Link>\` 组件的 API 参考文档。
102+
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.
78105
79106
Output format:
80107
• Provide only the translated content

0 commit comments

Comments
 (0)