@jjlmoya/utils-language 1.1.0 → 1.3.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 +1 -1
- package/src/category/i18n/de.ts +4 -3
- package/src/category/i18n/es.ts +4 -3
- package/src/category/i18n/fr.ts +4 -3
- package/src/category/i18n/id.ts +4 -3
- package/src/category/i18n/it.ts +4 -3
- package/src/category/i18n/ja.ts +4 -3
- package/src/category/i18n/ko.ts +4 -3
- package/src/category/i18n/nl.ts +4 -3
- package/src/category/i18n/pl.ts +4 -3
- package/src/category/i18n/pt.ts +4 -3
- package/src/category/i18n/ru.ts +4 -3
- package/src/category/i18n/sv.ts +4 -3
- package/src/category/i18n/tr.ts +4 -3
- package/src/category/i18n/zh.ts +4 -3
- package/src/tests/category_quality.test.ts +94 -0
- package/src/tests/category_slug_localization.test.ts +29 -0
- package/src/tests/qa-test-helpers.ts +31 -0
- package/src/tests/qa_bibliography_links.test.ts +50 -0
- package/src/tests/qa_claim_evidence.test.ts +68 -0
- package/src/tests/qa_logic_reference_coverage.test.ts +45 -0
- package/src/tests/qa_runtime_i18n.test.ts +99 -0
- package/src/tool/language-learning-study-plan-planner/validation.ts +15 -0
- package/src/category/i18n/shared.ts +0 -11
package/package.json
CHANGED
package/src/category/i18n/de.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'sprachen',
|
|
4
5
|
title: 'Werkzeuge zum Sprachenlernen',
|
|
5
6
|
description: 'Private Browser Werkzeuge, die Sprachlernziele in praktische Lernplaene, Wochenroutinen und messbare Meilensteine verwandeln.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Auswahl, Niveau, Frist und Zeitplan bleiben im Browser. Es ist kein Konto erforderlich und die Eingaben werden nicht an einen Server gesendet.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Werkzeug', value: '1', icon: 'mdi:tools' }, { label: 'Niveaus', value: 'A0 bis C2', icon: 'mdi:stairs-up' }, { label: 'Sprachen', value: '10', icon: 'mdi:translate' }, { label: 'Privatsphaere', value: 'Lokal', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/es.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'idiomas',
|
|
4
5
|
title: 'Herramientas para aprender idiomas',
|
|
5
6
|
description: 'Herramientas privadas en el navegador para convertir objetivos lingüísticos en planes de estudio, sesiones semanales e hitos medibles.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Tus idiomas, nivel, fecha y horario se quedan en el navegador. No necesitas una cuenta y tus datos no se envían a un servidor.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Herramienta', value: '1', icon: 'mdi:tools' }, { label: 'Niveles', value: 'A0 a C2', icon: 'mdi:stairs-up' }, { label: 'Idiomas', value: '10', icon: 'mdi:translate' }, { label: 'Privacidad', value: 'Local', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/fr.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'langues',
|
|
4
5
|
title: 'Outils pour apprendre les langues',
|
|
5
6
|
description: 'Des outils privés dans le navigateur pour transformer des objectifs linguistiques en plans pratiques, séances hebdomadaires et jalons mesurables.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Vos choix de langue, votre niveau, votre date et votre rythme restent dans le navigateur. Aucun compte n est nécessaire et vos données ne sont pas envoyées à un serveur.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Outil', value: '1', icon: 'mdi:tools' }, { label: 'Niveaux', value: 'A0 à C2', icon: 'mdi:stairs-up' }, { label: 'Langues', value: '10', icon: 'mdi:translate' }, { label: 'Confidentialité', value: 'Locale', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/id.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'bahasa',
|
|
4
5
|
title: 'Alat Belajar Bahasa',
|
|
5
6
|
description: 'Alat privat berbasis browser untuk mengubah tujuan belajar bahasa menjadi rencana praktis, sesi mingguan, dan pencapaian yang terukur.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Pilihan bahasa, level, tanggal, dan jadwal tetap berada di browser. Tidak perlu akun dan masukan Anda tidak dikirim ke server.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Alat', value: '1', icon: 'mdi:tools' }, { label: 'Level', value: 'A0 sampai C2', icon: 'mdi:stairs-up' }, { label: 'Bahasa', value: '10', icon: 'mdi:translate' }, { label: 'Privasi', value: 'Lokal', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/it.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'lingue',
|
|
4
5
|
title: 'Strumenti per imparare le lingue',
|
|
5
6
|
description: 'Strumenti privati nel browser per trasformare gli obiettivi linguistici in piani pratici, sessioni settimanali e traguardi misurabili.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Le tue lingue, il livello, la data e il programma restano nel browser. Non serve un account e i dati non vengono inviati a un server.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Strumento', value: '1', icon: 'mdi:tools' }, { label: 'Livelli', value: 'A0 a C2', icon: 'mdi:stairs-up' }, { label: 'Lingue', value: '10', icon: 'mdi:translate' }, { label: 'Privacy', value: 'Locale', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/ja.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'gengo',
|
|
4
5
|
title: '語学学習ツール',
|
|
5
6
|
description: '語学の目標を実用的な学習計画、毎週の学習時間、確認できる到達目安に変える、ブラウザーで使えるプライベートなツールです。',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: '言語、レベル、日付、予定はブラウザー内にとどまります。アカウントは不要で、入力内容をサーバーへ送信しません。' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'ツール', value: '1', icon: 'mdi:tools' }, { label: 'レベル', value: 'A0からC2', icon: 'mdi:stairs-up' }, { label: '言語', value: '10', icon: 'mdi:translate' }, { label: 'プライバシー', value: 'ローカル', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/ko.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'eoneo',
|
|
4
5
|
title: '언어 학습 도구',
|
|
5
6
|
description: '언어 학습 목표를 실용적인 계획과 주간 학습 세션, 확인 가능한 중간 목표로 바꾸는 브라우저 기반 비공개 도구입니다.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: '언어 선택, 수준, 날짜와 일정은 브라우저에 남습니다. 계정이 필요하지 않으며 입력값을 서버로 보내지 않습니다.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: '도구', value: '1', icon: 'mdi:tools' }, { label: '수준', value: 'A0부터 C2', icon: 'mdi:stairs-up' }, { label: '언어', value: '10', icon: 'mdi:translate' }, { label: '개인정보', value: '로컬', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/nl.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'talen',
|
|
4
5
|
title: 'Hulpmiddelen voor taal leren',
|
|
5
6
|
description: 'Private browsertools om taaldoelen om te zetten in praktische studieplannen, wekelijkse sessies en meetbare mijlpalen.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Je taalkeuzes, niveau, datum en schema blijven in de browser. Een account is niet nodig en je invoer wordt niet naar een server gestuurd.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Tool', value: '1', icon: 'mdi:tools' }, { label: 'Niveaus', value: 'A0 tot C2', icon: 'mdi:stairs-up' }, { label: 'Talen', value: '10', icon: 'mdi:translate' }, { label: 'Privacy', value: 'Lokaal', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/pl.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'jezyki',
|
|
4
5
|
title: 'Narzędzia do nauki języków',
|
|
5
6
|
description: 'Prywatne narzędzia w przeglądarce, które zamieniają cele językowe w praktyczne plany, tygodniowe sesje i mierzalne kamienie milowe.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Wybrane języki, poziom, data i harmonogram pozostają w przeglądarce. Konto nie jest potrzebne, a dane nie są wysyłane na serwer.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Narzędzie', value: '1', icon: 'mdi:tools' }, { label: 'Poziomy', value: 'A0 do C2', icon: 'mdi:stairs-up' }, { label: 'Języki', value: '10', icon: 'mdi:translate' }, { label: 'Prywatność', value: 'Lokalnie', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/pt.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'idiomas',
|
|
4
5
|
title: 'Ferramentas para aprender idiomas',
|
|
5
6
|
description: 'Ferramentas privadas no navegador para transformar metas linguísticas em planos práticos, sessões semanais e marcos mensuráveis.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Seus idiomas, nível, data e cronograma ficam no navegador. Não é preciso ter conta e suas entradas não são enviadas para um servidor.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Ferramenta', value: '1', icon: 'mdi:tools' }, { label: 'Níveis', value: 'A0 a C2', icon: 'mdi:stairs-up' }, { label: 'Idiomas', value: '10', icon: 'mdi:translate' }, { label: 'Privacidade', value: 'Local', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/ru.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'yazyki',
|
|
4
5
|
title: 'Инструменты для изучения языков',
|
|
5
6
|
description: 'Приватные браузерные инструменты, которые превращают языковые цели в практичные планы, недельные занятия и измеримые промежуточные цели.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Выбранные языки, уровень, дата и расписание остаются в браузере. Учётная запись не нужна, а данные не отправляются на сервер.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Инструмент', value: '1', icon: 'mdi:tools' }, { label: 'Уровни', value: 'A0 до C2', icon: 'mdi:stairs-up' }, { label: 'Языки', value: '10', icon: 'mdi:translate' }, { label: 'Приватность', value: 'Локально', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/sv.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'sprak',
|
|
4
5
|
title: 'Verktyg för språkinlärning',
|
|
5
6
|
description: 'Privata webbläsarverktyg som gör språkmål till praktiska studieplaner, veckopass och mätbara milstolpar.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Dina språkval, din nivå, ditt datum och ditt schema stannar i webbläsaren. Inget konto krävs och uppgifterna skickas inte till en server.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Verktyg', value: '1', icon: 'mdi:tools' }, { label: 'Nivåer', value: 'A0 till C2', icon: 'mdi:stairs-up' }, { label: 'Språk', value: '10', icon: 'mdi:translate' }, { label: 'Integritet', value: 'Lokalt', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/tr.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'diller',
|
|
4
5
|
title: 'Dil öğrenme araçları',
|
|
5
6
|
description: 'Dil hedeflerini pratik planlara, haftalık çalışma oturumlarına ve ölçülebilir kilometre taşlarına dönüştüren özel tarayıcı araçları.',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: 'Dil seçimlerin, seviyen, tarihin ve programın tarayıcıda kalır. Hesap gerekmez ve girdilerin sunucuya gönderilmez.' },
|
|
13
14
|
{ type: 'stats', items: [{ label: 'Araç', value: '1', icon: 'mdi:tools' }, { label: 'Seviyeler', value: 'A0 ile C2', icon: 'mdi:stairs-up' }, { label: 'Diller', value: '10', icon: 'mdi:translate' }, { label: 'Gizlilik', value: 'Yerel', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
package/src/category/i18n/zh.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CategoryLocaleContent } from '../../types';
|
|
2
2
|
|
|
3
|
-
export const content =
|
|
3
|
+
export const content: CategoryLocaleContent = {
|
|
4
|
+
slug: 'yuyan',
|
|
4
5
|
title: '语言学习工具',
|
|
5
6
|
description: '在浏览器中使用的隐私工具,将语言目标转化为实用的学习计划、每周练习和可衡量的阶段目标。',
|
|
6
7
|
seo: [
|
|
@@ -12,4 +13,4 @@ export const content = createLanguageCategory({
|
|
|
12
13
|
{ type: 'paragraph', html: '你选择的语言、等级、日期和安排都保留在浏览器中。不需要账号,输入内容也不会发送到服务器。' },
|
|
13
14
|
{ type: 'stats', items: [{ label: '工具', value: '1', icon: 'mdi:tools' }, { label: '等级', value: 'A0 到 C2', icon: 'mdi:stairs-up' }, { label: '语言', value: '10', icon: 'mdi:translate' }, { label: '隐私', value: '本地', icon: 'mdi:shield-check' }] },
|
|
14
15
|
],
|
|
15
|
-
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { languageCategory } from '../data';
|
|
5
|
+
|
|
6
|
+
const EXPECTED_LOCALES = ['de', 'en', 'es', 'fr', 'id', 'it', 'ja', 'ko', 'nl', 'pl', 'pt', 'ru', 'sv', 'tr', 'zh'] as const;
|
|
7
|
+
const EXPECTED_SLUGS = {
|
|
8
|
+
de: 'sprachen', en: 'language', es: 'idiomas', fr: 'langues', id: 'bahasa',
|
|
9
|
+
it: 'lingue', ja: 'gengo', ko: 'eoneo', nl: 'talen', pl: 'jezyki', pt: 'idiomas',
|
|
10
|
+
ru: 'yazyki', sv: 'sprak', tr: 'diller', zh: 'yuyan',
|
|
11
|
+
} as const;
|
|
12
|
+
const CATEGORY_DIR = join(process.cwd(), 'src', 'category', 'i18n');
|
|
13
|
+
const SEO_TYPES = new Set(['title', 'paragraph', 'list', 'stats']);
|
|
14
|
+
|
|
15
|
+
type CategoryContent = {
|
|
16
|
+
slug: string;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
seo: Array<Record<string, unknown>>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function sectionText(section: Record<string, unknown>): string {
|
|
23
|
+
const value = section.text ?? section.html ?? '';
|
|
24
|
+
return typeof value === 'string' ? value.replace(/<[^>]*>/g, '').trim() : '';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('Language category quality', () => {
|
|
28
|
+
it('has one registered category with a usable icon and unique tools', () => {
|
|
29
|
+
expect(languageCategory.icon.trim()).not.toBe('');
|
|
30
|
+
expect(languageCategory.tools.length).toBeGreaterThan(0);
|
|
31
|
+
const ids = languageCategory.tools.map((tool) => tool.id);
|
|
32
|
+
expect(new Set(ids).size).toBe(ids.length);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('declares every locale in the category registry', () => {
|
|
36
|
+
expect(Object.keys(languageCategory.i18n).sort()).toEqual([...EXPECTED_LOCALES].sort());
|
|
37
|
+
for (const locale of EXPECTED_LOCALES) {
|
|
38
|
+
expect(typeof languageCategory.i18n[locale]).toBe('function');
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('keeps each locale source independent and explicit about its slug', () => {
|
|
43
|
+
expect(existsSync(join(CATEGORY_DIR, 'shared.ts'))).toBe(false);
|
|
44
|
+
for (const locale of EXPECTED_LOCALES) {
|
|
45
|
+
const source = readFileSync(join(CATEGORY_DIR, `${locale}.ts`), 'utf8');
|
|
46
|
+
expect(source, `${locale}.ts must declare its own slug`).toMatch(/(?:const\s+slug\s*=|\bslug\s*:)/);
|
|
47
|
+
expect(source, `${locale}.ts must not import a shared category translation`).not.toContain("from './shared'");
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('uses valid localized slugs and complete metadata in every locale', async () => {
|
|
52
|
+
for (const locale of EXPECTED_LOCALES) {
|
|
53
|
+
const content = await languageCategory.i18n[locale]!() as CategoryContent;
|
|
54
|
+
expect(content.slug).toBe(EXPECTED_SLUGS[locale]);
|
|
55
|
+
expect(content.slug).toMatch(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
56
|
+
expect(content.title.length).toBeGreaterThanOrEqual(5);
|
|
57
|
+
expect(content.title.length).toBeLessThanOrEqual(70);
|
|
58
|
+
expect(content.description.length).toBeGreaterThanOrEqual(20);
|
|
59
|
+
expect(content.description.length).toBeLessThanOrEqual(220);
|
|
60
|
+
expect(content.title).not.toMatch(/[|]/);
|
|
61
|
+
expect(content.description).not.toContain('\uFFFD');
|
|
62
|
+
expect(content.seo.length).toBeGreaterThan(0);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('keeps SEO structure and useful text in parity with English', async () => {
|
|
67
|
+
const english = await languageCategory.i18n.en!() as CategoryContent;
|
|
68
|
+
const englishTypes = english.seo.map((section) => section.type);
|
|
69
|
+
|
|
70
|
+
for (const locale of EXPECTED_LOCALES) {
|
|
71
|
+
const content = await languageCategory.i18n[locale]!() as CategoryContent;
|
|
72
|
+
expect(content.seo.map((section) => section.type), locale).toEqual(englishTypes);
|
|
73
|
+
if (locale !== 'en') {
|
|
74
|
+
expect(content.title).not.toBe(english.title);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (const section of content.seo) {
|
|
78
|
+
expect(SEO_TYPES.has(String(section.type)), `${locale} has an unsupported SEO section type`).toBe(true);
|
|
79
|
+
const text = sectionText(section);
|
|
80
|
+
if (section.type === 'title') {
|
|
81
|
+
expect(text.length, `${locale} SEO title is empty`).toBeGreaterThanOrEqual(8);
|
|
82
|
+
}
|
|
83
|
+
if (section.type === 'paragraph') {
|
|
84
|
+
expect(text.length, `${locale} SEO paragraph is too short`).toBeGreaterThanOrEqual(20);
|
|
85
|
+
}
|
|
86
|
+
if (section.type === 'stats') {
|
|
87
|
+
expect(Array.isArray(section.items), `${locale} SEO stats need items`).toBe(true);
|
|
88
|
+
expect((section.items as unknown[]).length).toBeGreaterThan(0);
|
|
89
|
+
}
|
|
90
|
+
expect(JSON.stringify(section)).not.toContain('\uFFFD');
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { languageCategory } from '../data';
|
|
3
|
+
|
|
4
|
+
const EXPECTED_SLUGS = {
|
|
5
|
+
de: 'sprachen',
|
|
6
|
+
en: 'language',
|
|
7
|
+
es: 'idiomas',
|
|
8
|
+
fr: 'langues',
|
|
9
|
+
id: 'bahasa',
|
|
10
|
+
it: 'lingue',
|
|
11
|
+
ja: 'gengo',
|
|
12
|
+
ko: 'eoneo',
|
|
13
|
+
nl: 'talen',
|
|
14
|
+
pl: 'jezyki',
|
|
15
|
+
pt: 'idiomas',
|
|
16
|
+
ru: 'yazyki',
|
|
17
|
+
sv: 'sprak',
|
|
18
|
+
tr: 'diller',
|
|
19
|
+
zh: 'yuyan',
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
describe('Category slug localization', () => {
|
|
23
|
+
it('declares a localized slug in every category locale file', async () => {
|
|
24
|
+
for (const [locale, expectedSlug] of Object.entries(EXPECTED_SLUGS)) {
|
|
25
|
+
const content = await languageCategory.i18n[locale as keyof typeof languageCategory.i18n]!();
|
|
26
|
+
expect(content.slug, `Unexpected category slug for locale "${locale}"`).toBe(expectedSlug);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { join, relative } from 'node:path';
|
|
3
|
+
|
|
4
|
+
export const repositoryRoot = process.cwd();
|
|
5
|
+
export const toolRoot = join(repositoryRoot, 'src', 'tool');
|
|
6
|
+
|
|
7
|
+
export function listToolDirectories(): string[] {
|
|
8
|
+
return readdirSync(toolRoot)
|
|
9
|
+
.map((name) => join(toolRoot, name))
|
|
10
|
+
.filter((path) => statSync(path).isDirectory());
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function findFiles(directory: string, extensions: string[]): string[] {
|
|
14
|
+
const files: string[] = [];
|
|
15
|
+
|
|
16
|
+
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
17
|
+
const path = join(directory, entry.name);
|
|
18
|
+
if (entry.isDirectory()) files.push(...findFiles(path, extensions));
|
|
19
|
+
else if (extensions.some((extension) => entry.name.endsWith(extension))) files.push(path);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return files;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function read(path: string): string {
|
|
26
|
+
return readFileSync(path, 'utf8');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function displayPath(path: string): string {
|
|
30
|
+
return relative(repositoryRoot, path).replace(/\\/g, '/');
|
|
31
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { ALL_TOOLS } from '../tools';
|
|
3
|
+
import type { ToolLocaleContent } from '../types';
|
|
4
|
+
|
|
5
|
+
interface LinkFailure {
|
|
6
|
+
tool: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function validateLink(tool: string, entry: { url: string }, seen: Set<string>): LinkFailure[] {
|
|
11
|
+
const failures: LinkFailure[] = [];
|
|
12
|
+
let url: URL;
|
|
13
|
+
try {
|
|
14
|
+
url = new URL(entry.url);
|
|
15
|
+
} catch {
|
|
16
|
+
return [{ tool, message: `invalid URL: ${entry.url}` }];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (url.protocol !== 'https:') {
|
|
20
|
+
failures.push({ tool, message: `non-HTTPS URL: ${entry.url}` });
|
|
21
|
+
}
|
|
22
|
+
if (url.pathname === '/' && !url.search && !url.hash) {
|
|
23
|
+
failures.push({ tool, message: `generic homepage, cite the exact document: ${entry.url}` });
|
|
24
|
+
}
|
|
25
|
+
if (seen.has(url.href)) {
|
|
26
|
+
failures.push({ tool, message: `duplicate source URL: ${entry.url}` });
|
|
27
|
+
}
|
|
28
|
+
seen.add(url.href);
|
|
29
|
+
return failures;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async function validateTool(tool: typeof ALL_TOOLS[number]): Promise<LinkFailure[]> {
|
|
33
|
+
const loader = tool.entry.i18n.en;
|
|
34
|
+
if (!loader) {
|
|
35
|
+
return [{ tool: tool.entry.id, message: 'English locale loader is missing' }];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const content = (await loader()) as ToolLocaleContent;
|
|
39
|
+
const seen = new Set<string>();
|
|
40
|
+
return (content.bibliography ?? []).flatMap((entry) => validateLink(tool.entry.id, entry, seen));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe('QA: bibliography links are specific and usable', () => {
|
|
44
|
+
it('uses unique HTTPS links to exact source pages instead of generic homepages', async () => {
|
|
45
|
+
const failures = (await Promise.all(ALL_TOOLS.map(validateTool))).flat();
|
|
46
|
+
|
|
47
|
+
const messages = failures.map(({ tool, message }) => `${tool}: ${message}`);
|
|
48
|
+
expect(messages, `Bibliography hygiene failures:\n${messages.join('\n')}`).toEqual([]);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { displayPath, listToolDirectories, read } from './qa-test-helpers';
|
|
5
|
+
|
|
6
|
+
const evidenceClaims = [
|
|
7
|
+
/\bofficial algorithm\b/i,
|
|
8
|
+
/\balgoritmo oficial\b/i,
|
|
9
|
+
/\b(?:records|data|rates|tables) updated(?:\s+(?:to|through)\s+20\d{2})?\b/i,
|
|
10
|
+
/\b(?:registros|datos|tasas|tablas) actualizad[oa]s?(?:\s+(?:a|hasta)\s+20\d{2})?\b/i,
|
|
11
|
+
/\b(?:validated|verified) (?:method|algorithm|calculation)\b/i,
|
|
12
|
+
/\b(?:método|algoritmo|cálculo) (?:validado|verificado)\b/i,
|
|
13
|
+
/\b(?:guarantees|ensures)\b/i,
|
|
14
|
+
/\bgarantiza\b/i,
|
|
15
|
+
/\bofficial (?:data|rate|calculation)\b/i,
|
|
16
|
+
/\b(?:datos|tasa|cálculo) oficial(?:es)?\b/i,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const requiredEvidenceFields = [
|
|
20
|
+
'reviewedAt',
|
|
21
|
+
'methodology',
|
|
22
|
+
'sources',
|
|
23
|
+
'referenceCases',
|
|
24
|
+
'limitations',
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
describe('QA: strong factual claims are traceable', () => {
|
|
28
|
+
it('requires machine-readable validation evidence beside tools making strong claims', () => {
|
|
29
|
+
const failures: string[] = [];
|
|
30
|
+
|
|
31
|
+
for (const directory of listToolDirectories()) {
|
|
32
|
+
const localePaths = ['en', 'es']
|
|
33
|
+
.map((locale) => join(directory, 'i18n', `${locale}.ts`))
|
|
34
|
+
.filter(existsSync);
|
|
35
|
+
const claims = localePaths.flatMap((path) => {
|
|
36
|
+
const source = read(path);
|
|
37
|
+
return evidenceClaims
|
|
38
|
+
.filter((pattern) => pattern.test(source))
|
|
39
|
+
.map((pattern) => `${displayPath(path)} matches ${pattern.source}`);
|
|
40
|
+
});
|
|
41
|
+
if (claims.length === 0) continue;
|
|
42
|
+
|
|
43
|
+
const evidencePath = join(directory, 'validation.ts');
|
|
44
|
+
if (!existsSync(evidencePath)) {
|
|
45
|
+
failures.push(`${displayPath(evidencePath)} missing; claims: ${claims.join(' | ')}`);
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const evidence = read(evidencePath);
|
|
50
|
+
const missingFields = requiredEvidenceFields.filter(
|
|
51
|
+
(field) => !new RegExp(`\\b${field}\\s*:`).test(evidence),
|
|
52
|
+
);
|
|
53
|
+
if (missingFields.length > 0) {
|
|
54
|
+
failures.push(`${displayPath(evidencePath)} missing fields: ${missingFields.join(', ')}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
expect(
|
|
59
|
+
failures,
|
|
60
|
+
[
|
|
61
|
+
'Claims such as official, validated, guaranteed or updated need inspectable evidence.',
|
|
62
|
+
'Add validation.ts with reviewedAt, methodology, sources, referenceCases and limitations,',
|
|
63
|
+
'or weaken/remove the unsupported claim.',
|
|
64
|
+
...failures,
|
|
65
|
+
].join('\n'),
|
|
66
|
+
).toEqual([]);
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { basename, join } from 'node:path';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import {
|
|
5
|
+
displayPath,
|
|
6
|
+
findFiles,
|
|
7
|
+
listToolDirectories,
|
|
8
|
+
read,
|
|
9
|
+
repositoryRoot,
|
|
10
|
+
} from './qa-test-helpers';
|
|
11
|
+
|
|
12
|
+
function hasDedicatedLogicTest(toolDirectory: string): boolean {
|
|
13
|
+
const localCandidates = [
|
|
14
|
+
join(toolDirectory, 'logic.test.ts'),
|
|
15
|
+
join(toolDirectory, 'logic.spec.ts'),
|
|
16
|
+
join(toolDirectory, '__tests__', 'logic.test.ts'),
|
|
17
|
+
join(toolDirectory, '__tests__', 'logic.spec.ts'),
|
|
18
|
+
];
|
|
19
|
+
if (localCandidates.some(existsSync)) return true;
|
|
20
|
+
|
|
21
|
+
const toolName = basename(toolDirectory);
|
|
22
|
+
const centralTests = findFiles(join(repositoryRoot, 'src', 'tests'), ['.test.ts', '.spec.ts']);
|
|
23
|
+
return centralTests.some((testPath) => {
|
|
24
|
+
const source = read(testPath).replace(/\\/g, '/');
|
|
25
|
+
return source.includes(`/tool/${toolName}/logic`) || source.includes(`../tool/${toolName}/logic`);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('QA: calculation logic has reference tests', () => {
|
|
30
|
+
it('gives every public calculator logic module its own behavioral test suite', () => {
|
|
31
|
+
const failures = listToolDirectories()
|
|
32
|
+
.filter((directory) => existsSync(join(directory, 'logic.ts')))
|
|
33
|
+
.filter((directory) => !hasDedicatedLogicTest(directory))
|
|
34
|
+
.map((directory) => `${displayPath(join(directory, 'logic.ts'))} -> no test imports this module`);
|
|
35
|
+
|
|
36
|
+
expect(
|
|
37
|
+
failures,
|
|
38
|
+
[
|
|
39
|
+
'Add behavioral tests through each logic module public API.',
|
|
40
|
+
'At minimum cover a documented reference case, boundaries, invalid input and invariants.',
|
|
41
|
+
...failures,
|
|
42
|
+
].join('\n'),
|
|
43
|
+
).toEqual([]);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { basename, join } from 'node:path';
|
|
3
|
+
import { existsSync } from 'node:fs';
|
|
4
|
+
import {
|
|
5
|
+
displayPath,
|
|
6
|
+
findFiles,
|
|
7
|
+
listToolDirectories,
|
|
8
|
+
read,
|
|
9
|
+
repositoryRoot,
|
|
10
|
+
} from './qa-test-helpers';
|
|
11
|
+
|
|
12
|
+
interface VisibleLiteral {
|
|
13
|
+
line: number;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const domTextAssignment = /\.(?:innerText|textContent|innerHTML)\s*=/;
|
|
18
|
+
const quotedLiteral = /(['"`])((?:\\.|(?!\1).)*)\1/g;
|
|
19
|
+
|
|
20
|
+
function visibleWords(value: string): string {
|
|
21
|
+
return value
|
|
22
|
+
.replace(/\$\{[^}]*\}/g, ' ')
|
|
23
|
+
.replace(/<[^>]+>/g, ' ')
|
|
24
|
+
.replace(/&[a-z]+;/gi, ' ')
|
|
25
|
+
.replace(/[\d\p{P}\p{S}_]+/gu, ' ')
|
|
26
|
+
.replace(/\s+/g, ' ')
|
|
27
|
+
.trim();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isTechnicalLiteral(value: string): boolean {
|
|
31
|
+
return ['.', '#', '['].some((prefix) => value.startsWith(prefix))
|
|
32
|
+
|| /^data-[a-z0-9-]+$/i.test(value);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function hardcodedVisibleLiterals(source: string): VisibleLiteral[] {
|
|
36
|
+
const failures: VisibleLiteral[] = [];
|
|
37
|
+
|
|
38
|
+
source.split(/\r?\n/).forEach((line, index) => {
|
|
39
|
+
if (!domTextAssignment.test(line)) return;
|
|
40
|
+
|
|
41
|
+
const assignment = line.slice(line.search(domTextAssignment));
|
|
42
|
+
for (const match of assignment.matchAll(quotedLiteral)) {
|
|
43
|
+
if (isTechnicalLiteral(match[2])) continue;
|
|
44
|
+
const words = visibleWords(match[2]);
|
|
45
|
+
if (words && /\p{L}/u.test(words)) {
|
|
46
|
+
failures.push({ line: index + 1, value: match[2] });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return failures;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function runtimeSources(toolDirectory: string): string {
|
|
55
|
+
return findFiles(toolDirectory, ['.astro', '.ts', '.js'])
|
|
56
|
+
.filter((path) => !path.includes(`${join(toolDirectory, 'i18n')}`))
|
|
57
|
+
.filter((path) => basename(path) !== 'ui.ts')
|
|
58
|
+
.map(read)
|
|
59
|
+
.join('\n');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
describe('QA: runtime copy is localized', () => {
|
|
63
|
+
const componentFiles = findFiles(join(repositoryRoot, 'src', 'tool'), ['.astro']);
|
|
64
|
+
|
|
65
|
+
it('does not write user-facing string literals directly into the DOM', () => {
|
|
66
|
+
const failures = componentFiles.flatMap((path) =>
|
|
67
|
+
hardcodedVisibleLiterals(read(path)).map(
|
|
68
|
+
({ line, value }) => `${displayPath(path)}:${line} -> ${JSON.stringify(value)}`,
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
expect(
|
|
73
|
+
failures,
|
|
74
|
+
`Move visible browser copy to the tool UI locale contract:\n${failures.join('\n')}`,
|
|
75
|
+
).toEqual([]);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('uses every string declared by each UI locale contract', () => {
|
|
79
|
+
const failures: string[] = [];
|
|
80
|
+
|
|
81
|
+
for (const directory of listToolDirectories()) {
|
|
82
|
+
const uiPath = join(directory, 'ui.ts');
|
|
83
|
+
if (!existsSync(uiPath)) continue;
|
|
84
|
+
|
|
85
|
+
const keys = Array.from(read(uiPath).matchAll(/^\s*(\w+)\??:\s*string\s*;/gm), (match) => match[1]);
|
|
86
|
+
const runtime = runtimeSources(directory);
|
|
87
|
+
const unused = keys.filter((key) => !new RegExp(`\\b${key}\\b`).test(runtime));
|
|
88
|
+
|
|
89
|
+
if (unused.length > 0) {
|
|
90
|
+
failures.push(`${displayPath(uiPath)} -> unused: ${unused.join(', ')}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
expect(
|
|
95
|
+
failures,
|
|
96
|
+
`Unused locale keys are dead copy or may mean the browser bypasses translations:\n${failures.join('\n')}`,
|
|
97
|
+
).toEqual([]);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const validation = {
|
|
2
|
+
reviewedAt: '2026-08-29',
|
|
3
|
+
methodology: 'The planner uses broad guided-learning hour ranges as a planning estimate, subtracts the current level range from the target level range, and compares the result with weeks available at the selected weekly pace.',
|
|
4
|
+
sources: [
|
|
5
|
+
'https://www.coe.int/en/web/common-european-framework-reference-languages',
|
|
6
|
+
'https://www.cambridge.org/elt/blog/2020/08/19/how-long-learn-language/',
|
|
7
|
+
],
|
|
8
|
+
referenceCases: [
|
|
9
|
+
{ currentLevel: 'A1', targetLevel: 'B1', expectedHoursRange: '260-300' },
|
|
10
|
+
],
|
|
11
|
+
limitations: [
|
|
12
|
+
'The ranges are planning estimates, not a placement test or a guarantee of fluency.',
|
|
13
|
+
'Language distance, previous exposure, study quality, and real-world practice can materially change the time required.',
|
|
14
|
+
],
|
|
15
|
+
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { CategoryLocaleContent } from '../../types';
|
|
2
|
-
|
|
3
|
-
interface CategoryInput {
|
|
4
|
-
title: string;
|
|
5
|
-
description: string;
|
|
6
|
-
seo: CategoryLocaleContent['seo'];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function createLanguageCategory(input: CategoryInput): CategoryLocaleContent {
|
|
10
|
-
return { slug: 'language', ...input };
|
|
11
|
-
}
|