@goenhance/strapi-plugins-translate 1.0.4 → 1.0.6
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 +56 -89
- package/dist/server/index.mjs +56 -89
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -55,7 +55,7 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
55
55
|
results.forEach((result) => {
|
|
56
56
|
if (!entriesByDocId.has(result.documentId)) {
|
|
57
57
|
entriesByDocId.set(result.documentId, {
|
|
58
|
-
title: result
|
|
58
|
+
title: `[${result?.entryTitle}]-[${result.documentId}]`,
|
|
59
59
|
successes: [],
|
|
60
60
|
failures: []
|
|
61
61
|
});
|
|
@@ -103,37 +103,51 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
elements.push({
|
|
106
|
-
tag: "
|
|
107
|
-
|
|
108
|
-
header_style: {
|
|
109
|
-
text_align: "left",
|
|
110
|
-
text_size: "normal",
|
|
111
|
-
background_style: "grey",
|
|
112
|
-
bold: true,
|
|
113
|
-
lines: 1
|
|
114
|
-
},
|
|
115
|
-
columns: [
|
|
106
|
+
tag: "div",
|
|
107
|
+
fields: [
|
|
116
108
|
{
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
is_short: true,
|
|
110
|
+
text: {
|
|
111
|
+
tag: "lark_md",
|
|
112
|
+
content: `**内容类型**
|
|
113
|
+
${contentType}`
|
|
114
|
+
}
|
|
120
115
|
},
|
|
121
116
|
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
117
|
+
is_short: true,
|
|
118
|
+
text: {
|
|
119
|
+
tag: "lark_md",
|
|
120
|
+
content: `**源语言**
|
|
121
|
+
${sourceLocale}`
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
elements.push({
|
|
127
|
+
tag: "div",
|
|
128
|
+
fields: [
|
|
129
|
+
{
|
|
130
|
+
is_short: true,
|
|
131
|
+
text: {
|
|
132
|
+
tag: "lark_md",
|
|
133
|
+
content: `**目标语言**
|
|
134
|
+
${targetLocales.join(", ")}`
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
is_short: true,
|
|
139
|
+
text: {
|
|
140
|
+
tag: "lark_md",
|
|
141
|
+
content: `**总条目数**
|
|
142
|
+
${entriesByDocId.size}`
|
|
143
|
+
}
|
|
125
144
|
}
|
|
126
|
-
],
|
|
127
|
-
rows: [
|
|
128
|
-
["内容类型", contentType],
|
|
129
|
-
["源语言", sourceLocale],
|
|
130
|
-
["目标语言", targetLocales.join(", ")],
|
|
131
|
-
["总条目数", String(entriesByDocId.size)],
|
|
132
|
-
["✅ 成功翻译", String(successResults.length)],
|
|
133
|
-
["❌ 失败翻译", String(failureResults.length)]
|
|
134
145
|
]
|
|
135
146
|
});
|
|
136
147
|
if (successResults.length > 0) {
|
|
148
|
+
elements.push({
|
|
149
|
+
tag: "hr"
|
|
150
|
+
});
|
|
137
151
|
elements.push({
|
|
138
152
|
tag: "div",
|
|
139
153
|
text: {
|
|
@@ -141,39 +155,18 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
141
155
|
content: "**✅ 成功翻译详情**"
|
|
142
156
|
}
|
|
143
157
|
});
|
|
144
|
-
const successRows = [];
|
|
145
158
|
entriesByDocId.forEach((entry) => {
|
|
146
159
|
if (entry.successes.length > 0) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
160
|
+
elements.push({
|
|
161
|
+
tag: "div",
|
|
162
|
+
text: {
|
|
163
|
+
tag: "lark_md",
|
|
164
|
+
content: `📄 **${entry.title}**
|
|
165
|
+
→ ${entry.successes.join(", ")}`
|
|
166
|
+
}
|
|
167
|
+
});
|
|
151
168
|
}
|
|
152
169
|
});
|
|
153
|
-
elements.push({
|
|
154
|
-
tag: "table",
|
|
155
|
-
page_size: 10,
|
|
156
|
-
header_style: {
|
|
157
|
-
text_align: "left",
|
|
158
|
-
text_size: "normal",
|
|
159
|
-
background_style: "grey",
|
|
160
|
-
bold: true,
|
|
161
|
-
lines: 1
|
|
162
|
-
},
|
|
163
|
-
columns: [
|
|
164
|
-
{
|
|
165
|
-
name: "条目",
|
|
166
|
-
width: "auto",
|
|
167
|
-
data_type: "text"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
name: "目标语言",
|
|
171
|
-
width: "auto",
|
|
172
|
-
data_type: "text"
|
|
173
|
-
}
|
|
174
|
-
],
|
|
175
|
-
rows: successRows
|
|
176
|
-
});
|
|
177
170
|
}
|
|
178
171
|
if (failureResults.length > 0) {
|
|
179
172
|
elements.push({
|
|
@@ -186,48 +179,22 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
186
179
|
content: "**❌ 失败翻译详情**"
|
|
187
180
|
}
|
|
188
181
|
});
|
|
189
|
-
const failureRows = [];
|
|
190
182
|
entriesByDocId.forEach((entry) => {
|
|
191
183
|
if (entry.failures.length > 0) {
|
|
192
184
|
entry.failures.forEach((failure) => {
|
|
193
185
|
const errorMsg = failure.message || "未知错误";
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
186
|
+
elements.push({
|
|
187
|
+
tag: "div",
|
|
188
|
+
text: {
|
|
189
|
+
tag: "lark_md",
|
|
190
|
+
content: `📄 **${entry.title}**
|
|
191
|
+
→ ${failure.locale}
|
|
192
|
+
<font color='red'>错误: ${errorMsg}</font>`
|
|
193
|
+
}
|
|
194
|
+
});
|
|
199
195
|
});
|
|
200
196
|
}
|
|
201
197
|
});
|
|
202
|
-
elements.push({
|
|
203
|
-
tag: "table",
|
|
204
|
-
page_size: 10,
|
|
205
|
-
header_style: {
|
|
206
|
-
text_align: "left",
|
|
207
|
-
text_size: "normal",
|
|
208
|
-
background_style: "grey",
|
|
209
|
-
bold: true,
|
|
210
|
-
lines: 1
|
|
211
|
-
},
|
|
212
|
-
columns: [
|
|
213
|
-
{
|
|
214
|
-
name: "条目",
|
|
215
|
-
width: "auto",
|
|
216
|
-
data_type: "text"
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: "目标语言",
|
|
220
|
-
width: "auto",
|
|
221
|
-
data_type: "text"
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: "错误信息",
|
|
225
|
-
width: "auto",
|
|
226
|
-
data_type: "text"
|
|
227
|
-
}
|
|
228
|
-
],
|
|
229
|
-
rows: failureRows
|
|
230
|
-
});
|
|
231
198
|
}
|
|
232
199
|
elements.push({
|
|
233
200
|
tag: "hr"
|
package/dist/server/index.mjs
CHANGED
|
@@ -54,7 +54,7 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
54
54
|
results.forEach((result) => {
|
|
55
55
|
if (!entriesByDocId.has(result.documentId)) {
|
|
56
56
|
entriesByDocId.set(result.documentId, {
|
|
57
|
-
title: result
|
|
57
|
+
title: `[${result?.entryTitle}]-[${result.documentId}]`,
|
|
58
58
|
successes: [],
|
|
59
59
|
failures: []
|
|
60
60
|
});
|
|
@@ -102,37 +102,51 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
elements.push({
|
|
105
|
-
tag: "
|
|
106
|
-
|
|
107
|
-
header_style: {
|
|
108
|
-
text_align: "left",
|
|
109
|
-
text_size: "normal",
|
|
110
|
-
background_style: "grey",
|
|
111
|
-
bold: true,
|
|
112
|
-
lines: 1
|
|
113
|
-
},
|
|
114
|
-
columns: [
|
|
105
|
+
tag: "div",
|
|
106
|
+
fields: [
|
|
115
107
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
is_short: true,
|
|
109
|
+
text: {
|
|
110
|
+
tag: "lark_md",
|
|
111
|
+
content: `**内容类型**
|
|
112
|
+
${contentType}`
|
|
113
|
+
}
|
|
119
114
|
},
|
|
120
115
|
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
is_short: true,
|
|
117
|
+
text: {
|
|
118
|
+
tag: "lark_md",
|
|
119
|
+
content: `**源语言**
|
|
120
|
+
${sourceLocale}`
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
});
|
|
125
|
+
elements.push({
|
|
126
|
+
tag: "div",
|
|
127
|
+
fields: [
|
|
128
|
+
{
|
|
129
|
+
is_short: true,
|
|
130
|
+
text: {
|
|
131
|
+
tag: "lark_md",
|
|
132
|
+
content: `**目标语言**
|
|
133
|
+
${targetLocales.join(", ")}`
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
is_short: true,
|
|
138
|
+
text: {
|
|
139
|
+
tag: "lark_md",
|
|
140
|
+
content: `**总条目数**
|
|
141
|
+
${entriesByDocId.size}`
|
|
142
|
+
}
|
|
124
143
|
}
|
|
125
|
-
],
|
|
126
|
-
rows: [
|
|
127
|
-
["内容类型", contentType],
|
|
128
|
-
["源语言", sourceLocale],
|
|
129
|
-
["目标语言", targetLocales.join(", ")],
|
|
130
|
-
["总条目数", String(entriesByDocId.size)],
|
|
131
|
-
["✅ 成功翻译", String(successResults.length)],
|
|
132
|
-
["❌ 失败翻译", String(failureResults.length)]
|
|
133
144
|
]
|
|
134
145
|
});
|
|
135
146
|
if (successResults.length > 0) {
|
|
147
|
+
elements.push({
|
|
148
|
+
tag: "hr"
|
|
149
|
+
});
|
|
136
150
|
elements.push({
|
|
137
151
|
tag: "div",
|
|
138
152
|
text: {
|
|
@@ -140,39 +154,18 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
140
154
|
content: "**✅ 成功翻译详情**"
|
|
141
155
|
}
|
|
142
156
|
});
|
|
143
|
-
const successRows = [];
|
|
144
157
|
entriesByDocId.forEach((entry) => {
|
|
145
158
|
if (entry.successes.length > 0) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
159
|
+
elements.push({
|
|
160
|
+
tag: "div",
|
|
161
|
+
text: {
|
|
162
|
+
tag: "lark_md",
|
|
163
|
+
content: `📄 **${entry.title}**
|
|
164
|
+
→ ${entry.successes.join(", ")}`
|
|
165
|
+
}
|
|
166
|
+
});
|
|
150
167
|
}
|
|
151
168
|
});
|
|
152
|
-
elements.push({
|
|
153
|
-
tag: "table",
|
|
154
|
-
page_size: 10,
|
|
155
|
-
header_style: {
|
|
156
|
-
text_align: "left",
|
|
157
|
-
text_size: "normal",
|
|
158
|
-
background_style: "grey",
|
|
159
|
-
bold: true,
|
|
160
|
-
lines: 1
|
|
161
|
-
},
|
|
162
|
-
columns: [
|
|
163
|
-
{
|
|
164
|
-
name: "条目",
|
|
165
|
-
width: "auto",
|
|
166
|
-
data_type: "text"
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
name: "目标语言",
|
|
170
|
-
width: "auto",
|
|
171
|
-
data_type: "text"
|
|
172
|
-
}
|
|
173
|
-
],
|
|
174
|
-
rows: successRows
|
|
175
|
-
});
|
|
176
169
|
}
|
|
177
170
|
if (failureResults.length > 0) {
|
|
178
171
|
elements.push({
|
|
@@ -185,48 +178,22 @@ async function sendBatchTranslationNotification(contentType, sourceLocale, targe
|
|
|
185
178
|
content: "**❌ 失败翻译详情**"
|
|
186
179
|
}
|
|
187
180
|
});
|
|
188
|
-
const failureRows = [];
|
|
189
181
|
entriesByDocId.forEach((entry) => {
|
|
190
182
|
if (entry.failures.length > 0) {
|
|
191
183
|
entry.failures.forEach((failure) => {
|
|
192
184
|
const errorMsg = failure.message || "未知错误";
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
185
|
+
elements.push({
|
|
186
|
+
tag: "div",
|
|
187
|
+
text: {
|
|
188
|
+
tag: "lark_md",
|
|
189
|
+
content: `📄 **${entry.title}**
|
|
190
|
+
→ ${failure.locale}
|
|
191
|
+
<font color='red'>错误: ${errorMsg}</font>`
|
|
192
|
+
}
|
|
193
|
+
});
|
|
198
194
|
});
|
|
199
195
|
}
|
|
200
196
|
});
|
|
201
|
-
elements.push({
|
|
202
|
-
tag: "table",
|
|
203
|
-
page_size: 10,
|
|
204
|
-
header_style: {
|
|
205
|
-
text_align: "left",
|
|
206
|
-
text_size: "normal",
|
|
207
|
-
background_style: "grey",
|
|
208
|
-
bold: true,
|
|
209
|
-
lines: 1
|
|
210
|
-
},
|
|
211
|
-
columns: [
|
|
212
|
-
{
|
|
213
|
-
name: "条目",
|
|
214
|
-
width: "auto",
|
|
215
|
-
data_type: "text"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: "目标语言",
|
|
219
|
-
width: "auto",
|
|
220
|
-
data_type: "text"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
name: "错误信息",
|
|
224
|
-
width: "auto",
|
|
225
|
-
data_type: "text"
|
|
226
|
-
}
|
|
227
|
-
],
|
|
228
|
-
rows: failureRows
|
|
229
|
-
});
|
|
230
197
|
}
|
|
231
198
|
elements.push({
|
|
232
199
|
tag: "hr"
|
package/package.json
CHANGED