ultimate-jekyll-manager 0.0.43 → 0.0.44
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.
|
@@ -259,9 +259,10 @@ async function processTranslation() {
|
|
|
259
259
|
const outPath = isHomepage
|
|
260
260
|
? path.join('_site', `${lang}.html`)
|
|
261
261
|
: path.join('_site', lang, relativePath);
|
|
262
|
+
const logTag = `[${lang}] ${relativePath}`;
|
|
262
263
|
|
|
263
264
|
// Log
|
|
264
|
-
logger.log(`🌐
|
|
265
|
+
logger.log(`🌐 Translation started: ${logTag}`);
|
|
265
266
|
|
|
266
267
|
// Skip if the file is not in the meta or if it has no text nodes
|
|
267
268
|
let translated = null;
|
|
@@ -294,14 +295,14 @@ async function processTranslation() {
|
|
|
294
295
|
&& jetpack.exists(cachePath)
|
|
295
296
|
) {
|
|
296
297
|
translated = jetpack.read(cachePath);
|
|
297
|
-
logger.log(`📦
|
|
298
|
+
logger.log(`📦 Translation cache: ${logTag}`);
|
|
298
299
|
} else {
|
|
299
300
|
try {
|
|
300
301
|
const { result, usage } = await translateWithAPI(openAIKey, bodyText, lang);
|
|
301
302
|
|
|
302
303
|
// Log
|
|
303
304
|
const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
304
|
-
logger.log(`✅
|
|
305
|
+
logger.log(`✅ Translation succeeded: ${logTag} (Elapsed time: ${elapsedTime}s)`);
|
|
305
306
|
|
|
306
307
|
// Set translated result
|
|
307
308
|
translated = result;
|
|
@@ -317,7 +318,7 @@ async function processTranslation() {
|
|
|
317
318
|
setResult(true);
|
|
318
319
|
} catch (e) {
|
|
319
320
|
const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
320
|
-
logger.error(
|
|
321
|
+
logger.error(`❌ Translation failed: ${logTag} — ${e.message} (Elapsed time: ${elapsedTime}s)`);
|
|
321
322
|
|
|
322
323
|
// Set translated result
|
|
323
324
|
translated = bodyText;
|
|
@@ -342,7 +343,7 @@ async function processTranslation() {
|
|
|
342
343
|
const translation = match?.[1];
|
|
343
344
|
|
|
344
345
|
if (!translation) {
|
|
345
|
-
return logger.warn(`⚠️ Could not find translated tag for index ${i}`);
|
|
346
|
+
return logger.warn(`⚠️ Translation warning: ${logTag} - Could not find translated tag for index ${i}`);
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
// Extract original leading and trailing whitespace
|
|
@@ -372,12 +373,12 @@ async function processTranslation() {
|
|
|
372
373
|
controlTag.length === 0
|
|
373
374
|
|| controlTag.text() !== CONTROL
|
|
374
375
|
) {
|
|
375
|
-
logger.error(
|
|
376
|
+
logger.error(`❌ Translation failed: ${logTag} — Control tag mismatch or missing`);
|
|
376
377
|
|
|
377
378
|
return setResult(false);
|
|
378
379
|
} else {
|
|
379
380
|
// Delete the control tag
|
|
380
|
-
controlTag.remove();
|
|
381
|
+
// controlTag.remove();
|
|
381
382
|
}
|
|
382
383
|
|
|
383
384
|
// Set the lang attribute on the <html> tag
|