@adminforth/i18n 1.3.0 → 1.3.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/build.log +2 -2
- package/custom/ListCell.vue +8 -3
- package/dist/custom/ListCell.vue +8 -3
- package/dist/index.js +3 -2
- package/index.ts +5 -3
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -16,5 +16,5 @@ custom/package-lock.json
|
|
|
16
16
|
custom/package.json
|
|
17
17
|
custom/tsconfig.json
|
|
18
18
|
|
|
19
|
-
sent
|
|
20
|
-
total size is
|
|
19
|
+
sent 31,052 bytes received 229 bytes 62,562.00 bytes/sec
|
|
20
|
+
total size is 30,197 speedup is 0.97
|
package/custom/ListCell.vue
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative group flex items-center"
|
|
2
|
+
<div class="relative group flex items-center">
|
|
3
3
|
<!-- Normal value display -->
|
|
4
|
-
<div v-if="
|
|
4
|
+
<div v-if="column.editReadonly" class="flex items-center" :class="limitedText?.length > 50 ? 'min-w-48 max-w-full' : 'min-w-32'">
|
|
5
|
+
{{ limitedText? limitedText : '-' }}
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div @click.stop="startEdit()"
|
|
9
|
+
v-else-if="!isEditing" class="flex items-center" :class="limitedText?.length > 50 ? 'min-w-48 max-w-full' : 'min-w-32'">
|
|
5
10
|
{{ limitedText? limitedText : '-' }}
|
|
6
11
|
|
|
7
12
|
<span v-if="meta?.reviewedCheckboxesFieldName && limitedText" class="flex items-center ml-2">
|
|
@@ -31,7 +36,7 @@
|
|
|
31
36
|
</div>
|
|
32
37
|
|
|
33
38
|
<!-- Edit mode -->
|
|
34
|
-
<div v-else class="flex flex-col gap-2">
|
|
39
|
+
<div v-else class="flex flex-col gap-2" @click.stop>
|
|
35
40
|
<div class="flex items-center max-w-full gap-2"
|
|
36
41
|
:class="limitedText?.length > 50 ? 'min-w-72' : 'min-w-64'"
|
|
37
42
|
ref="inputHolder"
|
package/dist/custom/ListCell.vue
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="relative group flex items-center"
|
|
2
|
+
<div class="relative group flex items-center">
|
|
3
3
|
<!-- Normal value display -->
|
|
4
|
-
<div v-if="
|
|
4
|
+
<div v-if="column.editReadonly" class="flex items-center" :class="limitedText?.length > 50 ? 'min-w-48 max-w-full' : 'min-w-32'">
|
|
5
|
+
{{ limitedText? limitedText : '-' }}
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div @click.stop="startEdit()"
|
|
9
|
+
v-else-if="!isEditing" class="flex items-center" :class="limitedText?.length > 50 ? 'min-w-48 max-w-full' : 'min-w-32'">
|
|
5
10
|
{{ limitedText? limitedText : '-' }}
|
|
6
11
|
|
|
7
12
|
<span v-if="meta?.reviewedCheckboxesFieldName && limitedText" class="flex items-center ml-2">
|
|
@@ -31,7 +36,7 @@
|
|
|
31
36
|
</div>
|
|
32
37
|
|
|
33
38
|
<!-- Edit mode -->
|
|
34
|
-
<div v-else class="flex flex-col gap-2">
|
|
39
|
+
<div v-else class="flex flex-col gap-2" @click.stop>
|
|
35
40
|
<div class="flex items-center max-w-full gap-2"
|
|
36
41
|
:class="limitedText?.length > 50 ? 'min-w-72' : 'min-w-64'"
|
|
37
42
|
ref="inputHolder"
|
package/dist/index.js
CHANGED
|
@@ -440,9 +440,9 @@ export default class I18nPlugin extends AdminForthPlugin {
|
|
|
440
440
|
const langName = iso6391.getName(lang);
|
|
441
441
|
const requestSlavicPlurals = Object.keys(SLAVIC_PLURAL_EXAMPLES).includes(lang) && plurals;
|
|
442
442
|
const prompt = `
|
|
443
|
-
I need to translate strings in JSON to ${
|
|
443
|
+
I need to translate strings in JSON to ${langName} language (ISO 639-1 code ${lang}) from English for my web app.
|
|
444
444
|
${requestSlavicPlurals ? `You should provide 4 slavic forms (in format "zero count | singular count | 2-4 | 5+") e.g. "apple | apples" should become "${SLAVIC_PLURAL_EXAMPLES[lang]}"` : ''}
|
|
445
|
-
Keep keys, as is, write translation into values! Here are the strings:
|
|
445
|
+
Keep keys, as is, write translation into values! If keys have variables (in curly brackets), then translated strings should have them as well (variables itself should not be translated). Here are the strings:
|
|
446
446
|
|
|
447
447
|
\`\`\`json
|
|
448
448
|
${JSON.stringify(strings.reduce((acc, s) => {
|
|
@@ -451,6 +451,7 @@ ${JSON.stringify(strings.reduce((acc, s) => {
|
|
|
451
451
|
}, {}), null, 2)}
|
|
452
452
|
\`\`\`
|
|
453
453
|
`;
|
|
454
|
+
process.env.HEAVY_DEBUG && console.log(`🪲🔪LLM prompt >> ${prompt.length}, <<${prompt} :\n\n`, JSON.stringify(prompt));
|
|
454
455
|
// call OpenAI
|
|
455
456
|
const resp = yield this.options.completeAdapter.complete(prompt, [], prompt.length * 2);
|
|
456
457
|
process.env.HEAVY_DEBUG && console.log(`🪲🔪LLM resp >> ${prompt.length}, <<${resp.content.length} :\n\n`, JSON.stringify(resp));
|
package/index.ts
CHANGED
|
@@ -498,9 +498,9 @@ export default class I18nPlugin extends AdminForthPlugin {
|
|
|
498
498
|
const requestSlavicPlurals = Object.keys(SLAVIC_PLURAL_EXAMPLES).includes(lang) && plurals;
|
|
499
499
|
|
|
500
500
|
const prompt = `
|
|
501
|
-
I need to translate strings in JSON to ${
|
|
501
|
+
I need to translate strings in JSON to ${langName} language (ISO 639-1 code ${lang}) from English for my web app.
|
|
502
502
|
${requestSlavicPlurals ? `You should provide 4 slavic forms (in format "zero count | singular count | 2-4 | 5+") e.g. "apple | apples" should become "${SLAVIC_PLURAL_EXAMPLES[lang]}"` : ''}
|
|
503
|
-
Keep keys, as is, write translation into values! Here are the strings:
|
|
503
|
+
Keep keys, as is, write translation into values! If keys have variables (in curly brackets), then translated strings should have them as well (variables itself should not be translated). Here are the strings:
|
|
504
504
|
|
|
505
505
|
\`\`\`json
|
|
506
506
|
${
|
|
@@ -512,6 +512,8 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
|
|
|
512
512
|
\`\`\`
|
|
513
513
|
`;
|
|
514
514
|
|
|
515
|
+
process.env.HEAVY_DEBUG && console.log(`🪲🔪LLM prompt >> ${prompt.length}, <<${prompt} :\n\n`, JSON.stringify(prompt));
|
|
516
|
+
|
|
515
517
|
// call OpenAI
|
|
516
518
|
const resp = await this.options.completeAdapter.complete(
|
|
517
519
|
prompt,
|
|
@@ -520,7 +522,7 @@ JSON.stringify(strings.reduce((acc: object, s: { en_string: string }): object =>
|
|
|
520
522
|
);
|
|
521
523
|
|
|
522
524
|
process.env.HEAVY_DEBUG && console.log(`🪲🔪LLM resp >> ${prompt.length}, <<${resp.content.length} :\n\n`, JSON.stringify(resp));
|
|
523
|
-
|
|
525
|
+
|
|
524
526
|
if (resp.error) {
|
|
525
527
|
throw new AiTranslateError(resp.error);
|
|
526
528
|
}
|