@adminforth/i18n 1.0.18-next.2 → 1.0.18-next.3

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/index.js CHANGED
@@ -141,6 +141,7 @@ export default class I18N extends AdminForthPlugin {
141
141
  if (!enColumn) {
142
142
  throw new Error(`Field ${this.enFieldName} not found column to store english original string in resource ${resourceConfig.resourceId}`);
143
143
  }
144
+ enColumn.editReadonly = true;
144
145
  // if sourceFieldName defined, check it exists
145
146
  if (this.options.sourceFieldName) {
146
147
  if (!resourceConfig.columns.find(c => c.name === this.options.sourceFieldName)) {
@@ -290,7 +291,8 @@ export default class I18N extends AdminForthPlugin {
290
291
  process.env.HEAVY_DEBUG && console.log('🪲bulkTranslate done', selectedIds);
291
292
  this.updateUntranslatedMenuBadge();
292
293
  return {
293
- ok: true, error: undefined,
294
+ ok: true,
295
+ error: undefined,
294
296
  successMessage: yield tr(`Translated {count} items`, 'backend', {
295
297
  count: translatedCount,
296
298
  }),
@@ -375,10 +377,10 @@ ${JSON.stringify(strings.reduce((acc, s) => {
375
377
  }, {}), null, 2)}
376
378
  \`\`\`
377
379
  `;
378
- process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);
380
+ // process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);
379
381
  // call OpenAI
380
382
  const resp = yield this.options.completeAdapter.complete(prompt, [], 300);
381
- process.env.HEAVY_DEBUG && console.log('🧠 llm resp', resp);
383
+ // process.env.HEAVY_DEBUG && console.log('🧠 llm resp', resp);
382
384
  if (resp.error) {
383
385
  throw new AiTranslateError(resp.error);
384
386
  }
package/index.ts CHANGED
@@ -156,6 +156,8 @@ export default class I18N extends AdminForthPlugin {
156
156
  throw new Error(`Field ${this.enFieldName} not found column to store english original string in resource ${resourceConfig.resourceId}`);
157
157
  }
158
158
 
159
+ enColumn.editReadonly = true;
160
+
159
161
  // if sourceFieldName defined, check it exists
160
162
  if (this.options.sourceFieldName) {
161
163
  if (!resourceConfig.columns.find(c => c.name === this.options.sourceFieldName)) {
@@ -330,7 +332,8 @@ export default class I18N extends AdminForthPlugin {
330
332
  process.env.HEAVY_DEBUG && console.log('🪲bulkTranslate done', selectedIds);
331
333
  this.updateUntranslatedMenuBadge();
332
334
  return {
333
- ok: true, error: undefined,
335
+ ok: true,
336
+ error: undefined,
334
337
  successMessage: await tr(`Translated {count} items`, 'backend', {
335
338
  count: translatedCount,
336
339
  }),
@@ -440,7 +443,7 @@ ${
440
443
  \`\`\`
441
444
  `;
442
445
 
443
- process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);
446
+ // process.env.HEAVY_DEBUG && console.log('🧠 llm prompt', prompt);
444
447
 
445
448
  // call OpenAI
446
449
  const resp = await this.options.completeAdapter.complete(
@@ -449,7 +452,7 @@ ${
449
452
  300,
450
453
  );
451
454
 
452
- process.env.HEAVY_DEBUG && console.log('🧠 llm resp', resp);
455
+ // process.env.HEAVY_DEBUG && console.log('🧠 llm resp', resp);
453
456
 
454
457
  if (resp.error) {
455
458
  throw new AiTranslateError(resp.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/i18n",
3
- "version": "1.0.18-next.2",
3
+ "version": "1.0.18-next.3",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",