@goenhance/strapi-plugins-translate 1.1.0 → 1.1.2
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 +35 -13
- package/dist/server/index.mjs +35 -13
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -1279,21 +1279,43 @@ const llmService = ({ strapi: strapi2 }) => ({
|
|
|
1279
1279
|
}
|
|
1280
1280
|
});
|
|
1281
1281
|
const buildPrompt = (fields, targetLanguage) => {
|
|
1282
|
-
return `
|
|
1282
|
+
return `
|
|
1283
|
+
You are a professional localization engine.
|
|
1283
1284
|
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
2. Only translate string values
|
|
1287
|
-
3. Maintain any markdown formatting within the text
|
|
1288
|
-
4. Keep HTML tags intact if present
|
|
1289
|
-
5. Preserve any special characters or placeholders
|
|
1290
|
-
6. Return ONLY the translated JSON object
|
|
1291
|
-
7. Ensure the JSON is valid and well-formed. Keep arrays and nested objects intact
|
|
1292
|
-
8. Do not add any explanations or comments
|
|
1293
|
-
9. Ensure professional and culturally appropriate translations
|
|
1285
|
+
TARGET LANGUAGE:
|
|
1286
|
+
${targetLanguage}
|
|
1294
1287
|
|
|
1295
|
-
|
|
1296
|
-
${
|
|
1288
|
+
MANDATORY RULE:
|
|
1289
|
+
ALL translated string values MUST be written strictly in ${targetLanguage}.
|
|
1290
|
+
|
|
1291
|
+
Mixed languages are NOT allowed.
|
|
1292
|
+
Partial translation is NOT allowed.
|
|
1293
|
+
Do NOT preserve source language fragments.
|
|
1294
|
+
|
|
1295
|
+
If any string is not fully in ${targetLanguage}, correct it before output.
|
|
1296
|
+
|
|
1297
|
+
---
|
|
1298
|
+
|
|
1299
|
+
STRUCTURE RULES:
|
|
1300
|
+
- Preserve JSON structure.
|
|
1301
|
+
- Only translate string values.
|
|
1302
|
+
- Do not modify keys.
|
|
1303
|
+
- Do not add or remove fields.
|
|
1304
|
+
- Preserve placeholders, html, markdown, urls.
|
|
1305
|
+
- Return valid JSON only.
|
|
1306
|
+
|
|
1307
|
+
---
|
|
1308
|
+
|
|
1309
|
+
LANGUAGE VALIDATION CHECK:
|
|
1310
|
+
Before output:
|
|
1311
|
+
1. Scan all translated strings.
|
|
1312
|
+
2. Verify language consistency.
|
|
1313
|
+
3. Remove foreign-language fragments.
|
|
1314
|
+
4. Fix any untranslated content.
|
|
1315
|
+
|
|
1316
|
+
SOURCE:
|
|
1317
|
+
${JSON.stringify(fields, null, 2)}
|
|
1318
|
+
`;
|
|
1297
1319
|
};
|
|
1298
1320
|
const getUserConfig = async () => {
|
|
1299
1321
|
const pluginStore = strapi.store({
|
package/dist/server/index.mjs
CHANGED
|
@@ -1278,21 +1278,43 @@ const llmService = ({ strapi: strapi2 }) => ({
|
|
|
1278
1278
|
}
|
|
1279
1279
|
});
|
|
1280
1280
|
const buildPrompt = (fields, targetLanguage) => {
|
|
1281
|
-
return `
|
|
1281
|
+
return `
|
|
1282
|
+
You are a professional localization engine.
|
|
1282
1283
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
2. Only translate string values
|
|
1286
|
-
3. Maintain any markdown formatting within the text
|
|
1287
|
-
4. Keep HTML tags intact if present
|
|
1288
|
-
5. Preserve any special characters or placeholders
|
|
1289
|
-
6. Return ONLY the translated JSON object
|
|
1290
|
-
7. Ensure the JSON is valid and well-formed. Keep arrays and nested objects intact
|
|
1291
|
-
8. Do not add any explanations or comments
|
|
1292
|
-
9. Ensure professional and culturally appropriate translations
|
|
1284
|
+
TARGET LANGUAGE:
|
|
1285
|
+
${targetLanguage}
|
|
1293
1286
|
|
|
1294
|
-
|
|
1295
|
-
${
|
|
1287
|
+
MANDATORY RULE:
|
|
1288
|
+
ALL translated string values MUST be written strictly in ${targetLanguage}.
|
|
1289
|
+
|
|
1290
|
+
Mixed languages are NOT allowed.
|
|
1291
|
+
Partial translation is NOT allowed.
|
|
1292
|
+
Do NOT preserve source language fragments.
|
|
1293
|
+
|
|
1294
|
+
If any string is not fully in ${targetLanguage}, correct it before output.
|
|
1295
|
+
|
|
1296
|
+
---
|
|
1297
|
+
|
|
1298
|
+
STRUCTURE RULES:
|
|
1299
|
+
- Preserve JSON structure.
|
|
1300
|
+
- Only translate string values.
|
|
1301
|
+
- Do not modify keys.
|
|
1302
|
+
- Do not add or remove fields.
|
|
1303
|
+
- Preserve placeholders, html, markdown, urls.
|
|
1304
|
+
- Return valid JSON only.
|
|
1305
|
+
|
|
1306
|
+
---
|
|
1307
|
+
|
|
1308
|
+
LANGUAGE VALIDATION CHECK:
|
|
1309
|
+
Before output:
|
|
1310
|
+
1. Scan all translated strings.
|
|
1311
|
+
2. Verify language consistency.
|
|
1312
|
+
3. Remove foreign-language fragments.
|
|
1313
|
+
4. Fix any untranslated content.
|
|
1314
|
+
|
|
1315
|
+
SOURCE:
|
|
1316
|
+
${JSON.stringify(fields, null, 2)}
|
|
1317
|
+
`;
|
|
1296
1318
|
};
|
|
1297
1319
|
const getUserConfig = async () => {
|
|
1298
1320
|
const pluginStore = strapi.store({
|
package/package.json
CHANGED