You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/translate/src/openai.ts
+26-7Lines changed: 26 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -54,13 +54,32 @@ async function translateChunk(
54
54
consttextLength=chunk.length;
55
55
constprompt=`
56
56
Translate the following documentation from English to ${langConfig.name}.
57
-
The document being translated is of MDX file type, which means there are components in the text. Please ensure component closing tags are not missing, for example:
58
-
\`<AppOnly> </AppOnly>\` and \`<PagesOnly> </PagesOnly>\`.
59
-
Keep all code blocks, markdown formatting, HTML tags, and variables unchanged.
60
-
Do not translate text within \`\`\` code blocks or inline \`code\`.
61
-
Do not translate URLs or file paths.
62
-
Maintain the original paragraph structure and heading levels.
63
-
Provide only the translated content without any introduction, prefixes, or meta-explanations about the translation. Output just the translation itself.
57
+
58
+
General rules:
59
+
• The document is MDX format - ensure all component tags are properly closed (e.g., \`<AppOnly> </AppOnly>\` \`<PagesOnly> </PagesOnly>\` )
60
+
• Keep unchanged:
61
+
- All code blocks
62
+
- Markdown formatting
63
+
- HTML tags
64
+
- Variables
65
+
- Text within \`\`\` code blocks or inline \`code\`
66
+
- URLs and file paths
67
+
• Maintain the original paragraph structure and heading levels
68
+
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 中生成静态页面。
0 commit comments