@goenhance/strapi-plugins-translate 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.js +34 -11
- package/dist/server/index.mjs +34 -11
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -1279,18 +1279,41 @@ const llmService = ({ strapi: strapi2 }) => ({
|
|
|
1279
1279
|
}
|
|
1280
1280
|
});
|
|
1281
1281
|
const buildPrompt = (fields, targetLanguage) => {
|
|
1282
|
-
return `You are translating content
|
|
1282
|
+
return `You are translating CMS content into a specified target language.
|
|
1283
1283
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1284
|
+
Target Language:
|
|
1285
|
+
${targetLanguage}
|
|
1286
|
+
|
|
1287
|
+
IMPORTANT:
|
|
1288
|
+
You MUST translate strictly into the specified target language.
|
|
1289
|
+
Do NOT auto-detect language.
|
|
1290
|
+
Do NOT change the target language.
|
|
1291
|
+
If the target language is Italian, output must be Italian.
|
|
1292
|
+
If it is French, output must be French.
|
|
1293
|
+
Follow exactly the language provided.
|
|
1294
|
+
|
|
1295
|
+
---
|
|
1296
|
+
|
|
1297
|
+
TRANSLATION RULES:
|
|
1298
|
+
|
|
1299
|
+
1. Preserve the entire JSON structure and keys exactly as provided.
|
|
1300
|
+
2. Only translate string values.
|
|
1301
|
+
3. Do NOT modify keys, arrays, object structure, or data types.
|
|
1302
|
+
4. Preserve all markdown formatting inside text.
|
|
1303
|
+
5. Keep all HTML tags intact.
|
|
1304
|
+
6. Preserve placeholders like:
|
|
1305
|
+
{{variable}}, {variable}, %s, %d
|
|
1306
|
+
7. Preserve URLs, code blocks, technical tokens, and system identifiers.
|
|
1307
|
+
8. Return ONLY valid JSON.
|
|
1308
|
+
9. Do NOT add explanations, comments, or extra text.
|
|
1309
|
+
|
|
1310
|
+
---
|
|
1311
|
+
|
|
1312
|
+
Validation Step (Critical):
|
|
1313
|
+
Before outputting, verify:
|
|
1314
|
+
- All string values are written in ${targetLanguage}
|
|
1315
|
+
- No mixed languages remain
|
|
1316
|
+
- JSON structure is valid
|
|
1294
1317
|
|
|
1295
1318
|
SOURCE JSON:
|
|
1296
1319
|
${JSON.stringify(fields, null, 2)}`;
|
package/dist/server/index.mjs
CHANGED
|
@@ -1278,18 +1278,41 @@ const llmService = ({ strapi: strapi2 }) => ({
|
|
|
1278
1278
|
}
|
|
1279
1279
|
});
|
|
1280
1280
|
const buildPrompt = (fields, targetLanguage) => {
|
|
1281
|
-
return `You are translating content
|
|
1281
|
+
return `You are translating CMS content into a specified target language.
|
|
1282
1282
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1283
|
+
Target Language:
|
|
1284
|
+
${targetLanguage}
|
|
1285
|
+
|
|
1286
|
+
IMPORTANT:
|
|
1287
|
+
You MUST translate strictly into the specified target language.
|
|
1288
|
+
Do NOT auto-detect language.
|
|
1289
|
+
Do NOT change the target language.
|
|
1290
|
+
If the target language is Italian, output must be Italian.
|
|
1291
|
+
If it is French, output must be French.
|
|
1292
|
+
Follow exactly the language provided.
|
|
1293
|
+
|
|
1294
|
+
---
|
|
1295
|
+
|
|
1296
|
+
TRANSLATION RULES:
|
|
1297
|
+
|
|
1298
|
+
1. Preserve the entire JSON structure and keys exactly as provided.
|
|
1299
|
+
2. Only translate string values.
|
|
1300
|
+
3. Do NOT modify keys, arrays, object structure, or data types.
|
|
1301
|
+
4. Preserve all markdown formatting inside text.
|
|
1302
|
+
5. Keep all HTML tags intact.
|
|
1303
|
+
6. Preserve placeholders like:
|
|
1304
|
+
{{variable}}, {variable}, %s, %d
|
|
1305
|
+
7. Preserve URLs, code blocks, technical tokens, and system identifiers.
|
|
1306
|
+
8. Return ONLY valid JSON.
|
|
1307
|
+
9. Do NOT add explanations, comments, or extra text.
|
|
1308
|
+
|
|
1309
|
+
---
|
|
1310
|
+
|
|
1311
|
+
Validation Step (Critical):
|
|
1312
|
+
Before outputting, verify:
|
|
1313
|
+
- All string values are written in ${targetLanguage}
|
|
1314
|
+
- No mixed languages remain
|
|
1315
|
+
- JSON structure is valid
|
|
1293
1316
|
|
|
1294
1317
|
SOURCE JSON:
|
|
1295
1318
|
${JSON.stringify(fields, null, 2)}`;
|
package/package.json
CHANGED