@jjlmoya/utils-science 1.53.0 → 1.54.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.
package/package.json
CHANGED
|
@@ -30,11 +30,10 @@ function calculateSeoTextLength(seoSections: any[]): number {
|
|
|
30
30
|
|
|
31
31
|
function checkLocaleSeoLength(toolId: string, locale: string, localeLen: number, enLen: number): string | null {
|
|
32
32
|
const isAsian = ASIAN_LOCALES.includes(locale);
|
|
33
|
-
const minLength = Math.floor(enLen *
|
|
33
|
+
const minLength = isAsian ? 120 : Math.max(240, Math.floor(enLen * 0.35));
|
|
34
34
|
const msgType = isAsian ? 'suspiciously short' : 'truncated/lazy';
|
|
35
35
|
|
|
36
36
|
if (localeLen >= minLength) return null;
|
|
37
|
-
|
|
38
37
|
return `[LAZY SEO TRANSLATION] Tool "${toolId}" locale "${locale}" SEO text is ${msgType} (${localeLen} chars vs EN ${enLen} chars, expected min ${minLength})`;
|
|
39
38
|
}
|
|
40
39
|
|
|
@@ -57,8 +56,8 @@ describe('SEO Translation Completeness & Laziness Audit', () => {
|
|
|
57
56
|
if (!enContent.seo || !Array.isArray(enContent.seo)) return;
|
|
58
57
|
|
|
59
58
|
const enSeoLength = calculateSeoTextLength(enContent.seo);
|
|
60
|
-
|
|
61
59
|
const failures: string[] = [];
|
|
60
|
+
|
|
62
61
|
for (const [locale, loader] of Object.entries(entry.i18n)) {
|
|
63
62
|
const failure = await auditSingleLocale(entry.id, locale, loader, enSeoLength);
|
|
64
63
|
if (failure) failures.push(failure);
|
|
@@ -67,7 +66,7 @@ describe('SEO Translation Completeness & Laziness Audit', () => {
|
|
|
67
66
|
expect(
|
|
68
67
|
failures,
|
|
69
68
|
failures.length > 0
|
|
70
|
-
? `SEO translation completeness failures for "${entry.id}"
|
|
69
|
+
? `SEO translation completeness failures for "${entry.id}":\n${failures.map((failure, index) => `${index + 1}. ${failure}`).join('\n')}`
|
|
71
70
|
: undefined,
|
|
72
71
|
).toEqual([]);
|
|
73
72
|
});
|