@lokalise/connector-shell 3.1.0 → 3.2.0
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.
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { writeFileSync } from 'node:fs';
|
|
2
|
-
import { tmpdir } from 'node:os';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
1
|
import { CONNECTOR_ID_HEADER, postTranslateContract } from '@lokalise/connector-api-contracts';
|
|
5
2
|
import { buildFastifyPayloadRoute } from '@lokalise/fastify-api-contracts';
|
|
6
3
|
import { AbstractController } from 'opinionated-machine';
|
|
@@ -26,22 +23,6 @@ export class TranslateController extends AbstractController {
|
|
|
26
23
|
itemsCount: items.length,
|
|
27
24
|
items: stringValueSerializer(items),
|
|
28
25
|
}, `Content translated via ${adapter.getConnectorName()} adapter`);
|
|
29
|
-
// DEBUG: write each item's HTML translation to a file for manual inspection
|
|
30
|
-
for (const item of items) {
|
|
31
|
-
if (item.translations) {
|
|
32
|
-
for (const [locale, html] of Object.entries(item.translations)) {
|
|
33
|
-
const filename = `translate-debug-${item.uniqueId}-${locale}-${Date.now()}.html`;
|
|
34
|
-
const filepath = join(tmpdir(), filename);
|
|
35
|
-
try {
|
|
36
|
-
writeFileSync(filepath, html, 'utf-8');
|
|
37
|
-
req.reqContext.logger.info({ filepath, uniqueId: item.uniqueId, locale, sizeBytes: html.length }, 'DEBUG: Wrote translated HTML to file');
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
req.reqContext.logger.warn({ err, filepath }, 'DEBUG: Failed to write HTML debug file');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
26
|
await reply.send({ items });
|
|
46
27
|
}, this.protectedRouteMetadataMapper());
|
|
47
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translateController.js","sourceRoot":"","sources":["../../src/translate/translateController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translateController.js","sourceRoot":"","sources":["../../src/translate/translateController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAC9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAA8B,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAKrE,OAAO,mBAAmB,CAAA;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAI3D,MAAM,OAAO,mBAAoB,SAAQ,kBAAoD;IACpF,MAAM,CAAC,SAAS,GAAG;QACxB,aAAa,EAAE,qBAAqB;KAC5B,CAAA;IACO,QAAQ,CAAyB;IACjC,4BAA4B,CAAqC;IAElF,YAAY,YAAwC;QAClD,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAA;QACrC,IAAI,CAAC,4BAA4B,GAAG,YAAY,CAAC,mCAAmC,CAAA;IACtF,CAAC;IAED,IAAY,aAAa;QACvB,OAAO,wBAAwB,CAC7B,qBAAqB,EACrB,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;YACnB,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAA;YAC/E,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,gBAAgB,CAAC,UAAU,CACrD,GAAG,CAAC,iBAAiB,EACrB,GAAG,CAAC,UAAU,EACd,GAAG,CAAC,IAAI,CAAC,OAAO,EAChB,GAAG,CAAC,IAAI,CAAC,KAAK,EACd,GAAG,CAAC,IAAI,CAAC,aAAa,EACtB,GAAG,CAAC,UAAU,EACd,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE,CAChB,CAAA;YAED,GAAG,CAAC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