@@ -65,12 +65,16 @@ async function translateChunk(
6565 'description: API \\`getStaticProps\\` 参考文档。了解如何使用 \\`getStaticProps\\`。' ,
6666 'description: 关于 \\`<Link>\\` 组件的 API 参考文档。' ,
6767 'description: React \\`useState\\` 钩子的使用示例' ,
68+ "description: 缓存功能 'use cache' 的 API 设计和优势" ,
69+ 'description: 组件 "Button" 的使用指南' ,
6870 ] ,
6971 incorrect : [
7072 'title: \\`public\\` 目录中的静态资源' ,
7173 'description: \\`getStaticProps\\` API 参考文档。了解如何使用 \\`getStaticProps\\`。' ,
7274 'description: \\`<Link>\\` 组件的 API 参考文档。' ,
7375 'description: \\`useState\\` 钩子的使用示例' ,
76+ "description: 'use cache' 的 API 设计和优势" ,
77+ 'description: "Button" 组件的使用指南' ,
7478 ] ,
7579 } ,
7680 'zh-hant' : {
@@ -79,12 +83,16 @@ async function translateChunk(
7983 'description: API \\`getStaticProps\\` 參考文檔。了解如何使用 \\`getStaticProps\\`。' ,
8084 'description: 關於 \\`<Link>\\` 組件的 API 參考文檔。' ,
8185 'description: React \\`useState\\` 鉤子的使用示例' ,
86+ "description: 快取功能 'use cache' 的 API 設計和優勢" ,
87+ 'description: 組件 "Button" 的使用指南' ,
8288 ] ,
8389 incorrect : [
8490 'title: \\`public\\` 目錄中的靜態資源' ,
8591 'description: \\`getStaticProps\\` API 參考文檔。了解如何使用 \\`getStaticProps\\`。' ,
8692 'description: \\`<Link>\\` 組件的 API 參考文檔。' ,
8793 'description: \\`useState\\` 鉤子的使用示例' ,
94+ "description: 'use cache' 的 API 設計和優勢" ,
95+ 'description: "Button" 組件的使用指南' ,
8896 ] ,
8997 } ,
9098 ja : {
@@ -93,12 +101,16 @@ async function translateChunk(
93101 'description: API \\`getStaticProps\\` のリファレンス。\\`getStaticProps\\` の使用方法を学びます。' ,
94102 'description: React \\`<Link>\\` コンポーネントについての API リファレンス。' ,
95103 'description: React \\`useState\\` フックの使用例' ,
104+ "description: キャッシュ機能 'use cache' の API 設計と利点について学びます" ,
105+ 'description: コンポーネント "Button" の使用方法について説明します' ,
96106 ] ,
97107 incorrect : [
98108 'title: \\`public\\` ディレクトリの静的アセット' ,
99109 'description: \\`getStaticProps\\` API のリファレンス。\\`getStaticProps\\` の使用方法を学びます。' ,
100110 'description: \\`<Link>\\` コンポーネントの API リファレンス。' ,
101111 'description: \\`useState\\` フックの使用例' ,
112+ "description: 'use cache' の API 設計と利点について学びます" ,
113+ 'description: "Button" コンポーネントの使用方法について説明します' ,
102114 ] ,
103115 } ,
104116 ru : {
@@ -107,12 +119,16 @@ async function translateChunk(
107119 'description: Справочник API для компонента \\`<Link>\\`.' ,
108120 'title: Статические ресурсы (директория \\`public\\`)' ,
109121 'description: Примеры использования хука \\`useState\\` в React' ,
122+ "description: Функциональность кэша 'use cache' и её преимущества API" ,
123+ 'description: Руководство по использованию компонента "Button"' ,
110124 ] ,
111125 incorrect : [
112126 'title: \\`public\\` директория статических ресурсов' ,
113127 'description: \\`getStaticProps\\` справочник API. Узнайте, как использовать \\`getStaticProps\\`.' ,
114128 'description: \\`<Link>\\` справочник API компонента.' ,
115129 'description: \\`useState\\` примеры использования хука' ,
130+ "description: 'use cache' функциональность и преимущества API" ,
131+ 'description: "Button" руководство по использованию компонента' ,
116132 ] ,
117133 } ,
118134 de : {
@@ -121,12 +137,16 @@ async function translateChunk(
121137 'description: API-Referenz für \\`getStaticProps\\`. Erfahren Sie, wie Sie \\`getStaticProps\\` verwenden.' ,
122138 'description: API-Referenz für die \\`<Link>\\`-Komponente.' ,
123139 'description: React \\`useState\\`-Hook Verwendungsbeispiele' ,
140+ "description: Cache-Funktionalität 'use cache' und ihre API-Vorteile" ,
141+ 'description: Verwendungsanleitung für die "Button"-Komponente' ,
124142 ] ,
125143 incorrect : [
126144 'title: \\`public\\`-Verzeichnis statische Assets' ,
127145 'description: \\`getStaticProps\\` API-Referenz. Erfahren Sie, wie Sie \\`getStaticProps\\` verwenden.' ,
128146 'description: \\`<Link>\\`-Komponente API-Referenz.' ,
129147 'description: \\`useState\\`-Hook Verwendungsbeispiele' ,
148+ "description: 'use cache' Cache-Funktionalität und API-Vorteile" ,
149+ 'description: "Button"-Komponente Verwendungsanleitung' ,
130150 ] ,
131151 } ,
132152 fr : {
@@ -135,12 +155,16 @@ async function translateChunk(
135155 'description: Référence API pour \\`getStaticProps\\`. Apprenez à utiliser \\`getStaticProps\\`.' ,
136156 'description: Référence API pour le composant \\`<Link>\\`.' ,
137157 "description: Exemples d'utilisation du hook \\`useState\\` de React" ,
158+ "description: Fonctionnalité de cache 'use cache' et ses avantages API" ,
159+ 'description: Guide d\'utilisation du composant "Button"' ,
138160 ] ,
139161 incorrect : [
140162 'title: \\`public\\` répertoire des ressources statiques' ,
141163 'description: \\`getStaticProps\\` référence API. Apprenez à utiliser \\`getStaticProps\\`.' ,
142164 'description: \\`<Link>\\` référence API du composant.' ,
143165 "description: \\`useState\\` exemples d'utilisation du hook" ,
166+ "description: 'use cache' fonctionnalité et avantages API" ,
167+ 'description: "Button" guide d\'utilisation du composant' ,
144168 ] ,
145169 } ,
146170 es : {
@@ -149,12 +173,16 @@ async function translateChunk(
149173 'description: Referencia de API para \\`getStaticProps\\`. Aprende a usar \\`getStaticProps\\`.' ,
150174 'description: Referencia de API para el componente \\`<Link>\\`.' ,
151175 'description: Ejemplos de uso del hook \\`useState\\` de React' ,
176+ "description: Funcionalidad de caché 'use cache' y sus ventajas de API" ,
177+ 'description: Guía de uso del componente "Button"' ,
152178 ] ,
153179 incorrect : [
154180 'title: \\`public\\` directorio de recursos estáticos' ,
155181 'description: \\`getStaticProps\\` referencia de API. Aprende a usar \\`getStaticProps\\`.' ,
156182 'description: \\`<Link>\\` referencia de API del componente.' ,
157183 'description: \\`useState\\` ejemplos de uso del hook' ,
184+ "description: 'use cache' funcionalidad y ventajas de API" ,
185+ 'description: "Button" guía de uso del componente' ,
158186 ] ,
159187 } ,
160188 ar : {
@@ -163,12 +191,16 @@ async function translateChunk(
163191 'description: مرجع API لـ \\`getStaticProps\\`. تعلم كيفية استخدام \\`getStaticProps\\`.' ,
164192 'description: مرجع API لمكون \\`<Link>\\`.' ,
165193 'description: أمثلة استخدام خطاف \\`useState\\` في React' ,
194+ "description: وظيفة التخزين المؤقت 'use cache' ومزايا API الخاصة بها" ,
195+ 'description: دليل استخدام مكون "Button"' ,
166196 ] ,
167197 incorrect : [
168198 'title: \\`public\\` دليل الموارد الثابتة' ,
169199 'description: \\`getStaticProps\\` مرجع API. تعلم كيفية استخدام \\`getStaticProps\\`.' ,
170200 'description: \\`<Link>\\` مرجع API للمكون.' ,
171201 'description: \\`useState\\` أمثلة استخدام الخطاف' ,
202+ "description: 'use cache' وظيفة التخزين المؤقت ومزايا API" ,
203+ 'description: "Button" دليل استخدام المكون' ,
172204 ] ,
173205 } ,
174206 } ;
@@ -178,57 +210,38 @@ async function translateChunk(
178210
179211 const langExamples = getLanguageSpecificExamples ( langConfig . locale ) ;
180212
181- const frontmatterRules = `⚠️ CRITICAL MDX FRONTMATTER RULES ⚠️
213+ const frontmatterRules = `⚠️ CRITICAL MDX FRONT MATTER RULES ⚠️
182214• NEVER start a frontmatter value with inline code (text between \`backticks\`)
215+ • NEVER start a frontmatter value with single quotes ('text')
216+ • NEVER start a frontmatter value with double quotes ("text")
183217• This applies to ALL inline code including \`<Component>\` tags, \`functions\`, variables, etc.
184- • In frontmatter (sections between --- marks), ALWAYS rearrange sentences so inline code appears AFTER some text
185- • 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 ${ langExamples . incorrect [ 0 ] } , use ${ langExamples . correct [ 0 ] } .
218+ • This applies to ALL quoted text including 'use cache', "API design", 'components', etc.
219+ • In frontmatter (sections between --- marks), ALWAYS rearrange sentences so inline code and quoted text appears AFTER some text
220+ • If a frontmatter value would start with inline code or quotes after translation, ALWAYS rewrite the sentence so that some descriptive text comes before the inline code or quotes. For example, instead of ${ langExamples . incorrect [ 0 ] } , use ${ langExamples . correct [ 0 ] } .
186221• This rule applies to ALL frontmatter keys (title, description, etc.), not just description.
187222• ALWAYS preserve both the opening and closing frontmatter delimiters (---) - never omit the closing delimiter
188223• Maintain the exact structure of frontmatter - beginning with ---, followed by key-value pairs, and ending with ---
224+ • ENSURE VALID FRONT MATTER FORMAT: Use proper Front Matter syntax with key: value pairs, proper indentation with spaces (not tabs), and escape special characters when needed
189225• These rules are ABSOLUTELY REQUIRED for proper rendering of the documentation
190226
191227Examples of MDX Frontmatter Translation:
192228
193- # Example 1: Never start frontmatter values with inline code
194- ✓ CORRECT (Always do this):
195- Original:
196- title: \`public\` directory static assets
197- description: API reference for \`getStaticProps\`. Learn how to use \`getStaticProps\`.
198- description: API reference for the \`<Link>\` component.
199- description: \`useState\` hook usage examples
200- Translation:
201- ${ langExamples . correct . map ( ( ex ) => ` ${ ex } ` ) . join ( '\n' ) }
202-
203- ✗ INCORRECT (Never do this):
204- Original:
205- title: \`public\` directory static assets
206- description: API reference for \`getStaticProps\`. Learn how to use \`getStaticProps\`.
207- description: API reference for the \`<Link>\` component.
208- description: \`useState\` hook usage examples
209- Translation:
229+ # Example 1: Never start frontmatter values with inline code or quotes
230+ INCORRECT Translation (Never do this):
210231${ langExamples . incorrect . map ( ( ex ) => ` ${ ex } ` ) . join ( '\n' ) }
232+ CORRECT Translation (Always do this):
233+ ${ langExamples . correct . map ( ( ex ) => ` ${ ex } ` ) . join ( '\n' ) }
211234
212235# Example 2: Frontmatter Structure - always include closing delimiter
213- ✓ CORRECT (Always do this):
214- Original:
215- ---
216- title: \`public\` directory static assets
217- ---
218- Translation:
236+ INCORRECT Translation (Never do this):
219237 ---
220238 ${ langExamples . correct [ 0 ] }
221- ---
239+ (missing closing delimiter)
222240
223- ✗ INCORRECT (Never do this):
224- Original:
225- ---
226- title: \`public\` directory static assets
227- ---
228- Translation:
241+ CORRECT Translation (Always do this):
229242 ---
230243 ${ langExamples . correct [ 0 ] }
231- (missing closing delimiter)
244+ ---
232245
233246These rules apply ONLY to frontmatter (between --- marks) and are CRITICAL for proper document rendering.
234247REMEMBER: You must NEVER start with inline code in frontmatter values and ALWAYS include both opening and closing --- delimiters.` ;
@@ -276,7 +289,7 @@ Output format:
276289 } ,
277290 ] ;
278291
279- // console.log(systemPrompt + prompt);
292+ console . log ( systemPrompt + prompt ) ;
280293 // console.log(chunk);
281294
282295 const response = await openai . chat . completions . create ( {
0 commit comments