ultimate-jekyll-manager 0.0.44 → 0.0.46
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/gulp/tasks/translation.js +11 -11
- package/package.json +1 -1
|
@@ -196,13 +196,13 @@ async function processTranslation() {
|
|
|
196
196
|
try {
|
|
197
197
|
meta = jetpack.read(metaPath, 'json');
|
|
198
198
|
} catch (e) {
|
|
199
|
-
logger.warn(`⚠️
|
|
199
|
+
logger.warn(`⚠️ Meta: [${lang}] Failed to parse - starting fresh`);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
// Check if the promptHash matches; if not, invalidate the cache
|
|
204
204
|
if (meta.prompt?.hash !== promptHash) {
|
|
205
|
-
logger.warn(`⚠️
|
|
205
|
+
logger.warn(`⚠️ Meta: [${lang}] Prompt hash mismatch - invalidating cache.`);
|
|
206
206
|
meta = {};
|
|
207
207
|
}
|
|
208
208
|
|
|
@@ -262,7 +262,7 @@ async function processTranslation() {
|
|
|
262
262
|
const logTag = `[${lang}] ${relativePath}`;
|
|
263
263
|
|
|
264
264
|
// Log
|
|
265
|
-
logger.log(`🌐
|
|
265
|
+
logger.log(`🌐 Started: ${logTag}`);
|
|
266
266
|
|
|
267
267
|
// Skip if the file is not in the meta or if it has no text nodes
|
|
268
268
|
let translated = null;
|
|
@@ -295,14 +295,14 @@ async function processTranslation() {
|
|
|
295
295
|
&& jetpack.exists(cachePath)
|
|
296
296
|
) {
|
|
297
297
|
translated = jetpack.read(cachePath);
|
|
298
|
-
logger.log(`📦
|
|
298
|
+
logger.log(`📦 Success: ${logTag} - Using cache`);
|
|
299
299
|
} else {
|
|
300
300
|
try {
|
|
301
301
|
const { result, usage } = await translateWithAPI(openAIKey, bodyText, lang);
|
|
302
302
|
|
|
303
303
|
// Log
|
|
304
304
|
const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
305
|
-
logger.log(`✅
|
|
305
|
+
logger.log(`✅ Success: ${logTag} - Translated (Elapsed time: ${elapsedTime}s)`);
|
|
306
306
|
|
|
307
307
|
// Set translated result
|
|
308
308
|
translated = result;
|
|
@@ -318,7 +318,7 @@ async function processTranslation() {
|
|
|
318
318
|
setResult(true);
|
|
319
319
|
} catch (e) {
|
|
320
320
|
const elapsedTime = ((Date.now() - startTime) / 1000).toFixed(2);
|
|
321
|
-
logger.error(`❌
|
|
321
|
+
logger.error(`❌ Failed: ${logTag} — ${e.message} (Elapsed time: ${elapsedTime}s)`);
|
|
322
322
|
|
|
323
323
|
// Set translated result
|
|
324
324
|
translated = bodyText;
|
|
@@ -343,7 +343,7 @@ async function processTranslation() {
|
|
|
343
343
|
const translation = match?.[1];
|
|
344
344
|
|
|
345
345
|
if (!translation) {
|
|
346
|
-
return logger.warn(`⚠️
|
|
346
|
+
return logger.warn(`⚠️ Warning: ${logTag} - Could not find translated tag for index ${i}`);
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
// Extract original leading and trailing whitespace
|
|
@@ -373,14 +373,14 @@ async function processTranslation() {
|
|
|
373
373
|
controlTag.length === 0
|
|
374
374
|
|| controlTag.text() !== CONTROL
|
|
375
375
|
) {
|
|
376
|
-
logger.error(`❌
|
|
376
|
+
logger.error(`❌ Failed: ${logTag} — Control tag mismatch or missing`);
|
|
377
377
|
|
|
378
378
|
return setResult(false);
|
|
379
|
-
} else {
|
|
380
|
-
// Delete the control tag
|
|
381
|
-
// controlTag.remove();
|
|
382
379
|
}
|
|
383
380
|
|
|
381
|
+
// Delete the control tag
|
|
382
|
+
// controlTag.remove();
|
|
383
|
+
|
|
384
384
|
// Set the lang attribute on the <html> tag
|
|
385
385
|
$('html').attr('lang', lang);
|
|
386
386
|
|