Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions docs/docs/ar/testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
createdAt: 2025-03-01
updatedAt: 2025-09-20
updatedAt: 2026-10-27
priority: 8
title: "اختبار ترجماتك باستخدام Intlayer"
description: "اختبر محتوى Intlayer: اكتشف الترجمات الناقصة، وتحقّق من القواميس في CI، واعرض المكوّنات لكل لغة في اختبارات الوحدة."
Expand All @@ -14,6 +14,9 @@ slugs:
- doc
- testing
history:
- version: 6.1.0
date: 2026-10-27
changes: "توضيح أن content test ينتهي برمز غير صفري عند غياب اللغات المطلوبة"
- version: 6.0.0
date: 2025-09-20
changes: "تقديم الاختبارات"
Expand All @@ -28,7 +31,7 @@ author: aymericzip

- **الترجمات المفقودة**: فشل في CI إذا كانت هناك أي لغات مطلوبة مفقودة لأي قاموس.
- **عرض واجهة المستخدم المحلية**: عرض المكونات باستخدام مزود لغة محدد والتحقق من النصوص/السمات المرئية.
- **تدقيق وقت البناء**: إجراء تدقيق سريع محليًا عبر CLI.
- **تدقيق وقت البناء**: شغّل `npx intlayer content test` محليًا أو في CI؛ ينتهي برمز غير صفري عند غياب الترجمات المطلوبة.

## بداية سريعة: التدقيق عبر CLI

Expand Down Expand Up @@ -58,7 +61,7 @@ bun x intlayer content test
- `--verbose`: عرض سجلات مفصلة.
- `--prefix [label]`: إضافة بادئة لأسطر السجل.

ملاحظة: يقوم CLI بطباعة تقرير مفصل لكنه لا يخرج برمز خطأ عند الفشل. لاستخدامه في CI، أضف اختبار وحدة (أسفله) يؤكد عدم وجود لغات مطلوبة مفقودة.
ينتهي الأمر بالرمز `1` عندما تكون أي لغة مطلوبة مفقودة (انظر `requiredLocales` في إعداداتك)، وبالرمز `0` خلاف ذلك. يمكنك استخدامه مباشرة لإفشال مهام CI أو خطافات الالتزام. الاختبار البرمجي أدناه بديل اختياري.

## اختبار برمجي (Vitest/Jest)

Expand Down Expand Up @@ -154,14 +157,24 @@ test("يعرض العنوان المحلي بالفرنسية", () => {

## التكامل المستمر

أضف اختبارًا يفشل البناء عندما تكون الترجمات المطلوبة مفقودة.
شغّل تدقيق CLI في CI. يفشل المهمة عندما تكون الترجمات المطلوبة مفقودة.

`package.json`:

```json
{
"scripts": {
"test:i18n": "vitest run -c"
"test:i18n": "npx intlayer content test"
}
}
```

بديل: Vitest

```json
{
"scripts": {
"test:i18n": "vitest run"
}
}
```
Expand All @@ -180,7 +193,7 @@ jobs:
with:
node-version: 20
- run: npm ci
- run: npm run test:i18n
- run: npx intlayer content test
```

اختياري: قم بتشغيل تدقيق CLI للحصول على ملخص قابل للقراءة البشرية إلى جانب الاختبارات:
Expand Down
25 changes: 19 additions & 6 deletions docs/docs/de/testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
createdAt: 2025-03-01
updatedAt: 2025-09-20
updatedAt: 2026-10-27
priority: 8
title: "Übersetzungen mit Intlayer testen"
description: "Testen Sie Ihre Intlayer-Inhalte: fehlende Übersetzungen erkennen, Wörterbücher in CI validieren und Komponenten pro Locale in Unit-Tests rendern."
Expand All @@ -15,6 +15,9 @@ slugs:
- doc
- testing
history:
- version: 6.1.0
date: 2026-10-27
changes: "Klarstellung, dass content test bei fehlenden erforderlichen Sprachversionen mit einem von Null verschiedenen Code endet"
- version: 6.0.0
date: 2025-09-20
changes: "Einführung von Tests"
Expand All @@ -29,7 +32,7 @@ Dieser Leitfaden zeigt, wie Sie automatisch überprüfen können, ob Ihre Wörte

- **Fehlende Übersetzungen**: CI schlägt fehl, wenn für ein Wörterbuch erforderliche Sprachversionen fehlen.
- **Lokalisierte UI-Darstellung**: Komponenten mit einem bestimmten Sprachprovider rendern und sichtbaren Text/Attribute überprüfen.
- **Build-Zeit Prüfungen**: Führen Sie lokal eine schnelle Prüfung über die CLI durch.
- **Build-Zeit Prüfungen**: Führen Sie `npx intlayer content test` lokal oder in CI aus; der Befehl endet mit einem von Null verschiedenen Code, wenn erforderliche Übersetzungen fehlen.

## Schnellstart: Prüfung über CLI

Expand Down Expand Up @@ -59,7 +62,7 @@ Nützliche Optionen:
- `--verbose`: zeigt ausführliche Protokolle an.
- `--prefix [Label]`: fügt den Protokollzeilen ein Präfix hinzu.

Hinweis: Die CLI gibt einen detaillierten Bericht aus, beendet sich jedoch bei Fehlern nicht mit einem Fehlercode. Für CI-Gates fügen Sie einen Unit-Test (siehe unten) hinzu, der sicherstellt, dass keine erforderlichen Sprachversionen fehlen.
Der Befehl endet mit dem Code `1`, wenn eine erforderliche Sprachversion fehlt (siehe `requiredLocales` in Ihrer Konfiguration), andernfalls mit `0`. Sie können ihn direkt verwenden, um CI-Jobs oder Commit-Hooks fehlschlagen zu lassen. Der programmatische Test unten ist eine optionale Alternative.

## Programmatischer Test (Vitest/Jest)

Expand Down Expand Up @@ -155,14 +158,24 @@ Tipps:

## Kontinuierliche Integration

Fügen Sie einen Test hinzu, der den Build fehlschlagen lässt, wenn erforderliche Übersetzungen fehlen.
Führen Sie die CLI-Prüfung in CI aus. Sie lässt den Job fehlschlagen, wenn erforderliche Übersetzungen fehlen.

`package.json`:

```json
{
"scripts": {
"test:i18n": "vitest run -c"
"test:i18n": "npx intlayer content test"
}
}
```

Alternative: Vitest

```json
{
"scripts": {
"test:i18n": "vitest run"
}
}
```
Expand All @@ -181,7 +194,7 @@ jobs:
with:
node-version: 20
- run: npm ci
- run: npm run test:i18n
- run: npx intlayer content test
```

Optional: Führen Sie die CLI-Prüfung für eine menschenlesbare Zusammenfassung neben den Tests aus:
Expand Down
25 changes: 19 additions & 6 deletions docs/docs/en-GB/testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
createdAt: 2025-03-01
updatedAt: 2025-09-20
updatedAt: 2026-10-27
priority: 8
title: "Testing Your Translations with Intlayer"
description: "Test your Intlayer content: detect missing translations, validate dictionaries in CI and render components per locale in unit tests."
Expand All @@ -15,6 +15,9 @@ slugs:
- doc
- testing
history:
- version: 6.1.0
date: 2026-10-27
changes: "Clarify that content test exits non-zero on missing required locales"
- version: 6.0.0
date: 2025-09-20
changes: "Introduction of testing"
Expand All @@ -29,7 +32,7 @@ This guide shows how to automatically verify your dictionaries are complete, cat

- **Missing translations**: fail CI if any required locales are missing for any dictionary.
- **Localised UI rendering**: render components with a specific locale provider and assert on visible text/attributes.
- **Build-time audits**: run a quick audit locally via CLI.
- **Build-time audits**: run `npx intlayer content test` locally or in CI; it exits non-zero when required translations are missing.

## Quick start: audit via CLI

Expand Down Expand Up @@ -59,7 +62,7 @@ Useful flags:
- `--verbose`: show verbose logs.
- `--prefix [label]`: prefix log lines.

Note: the CLI prints a detailed report but does not exit with a non-zero code on failures. For CI gating, add a unit test (below) that asserts zero missing required locales.
The command exits with code `1` when any required locale is missing (see `requiredLocales` in your configuration), and `0` otherwise. You can use it directly to fail CI jobs or commit hooks. The programmatic test below is an optional alternative.

## Programmatic test (Vitest/Jest)

Expand Down Expand Up @@ -155,14 +158,24 @@ Tips:

## Continuous Integration

Add a test that fails the build when required translations are missing.
Run the CLI audit in CI. It fails the job when required translations are missing.

`package.json`:

```json
{
"scripts": {
"test:i18n": "vitest run -c"
"test:i18n": "npx intlayer content test"
}
}
```

Alternative: Vitest

```json
{
"scripts": {
"test:i18n": "vitest run"
}
}
```
Expand All @@ -181,7 +194,7 @@ jobs:
with:
node-version: 20
- run: npm ci
- run: npm run test:i18n
- run: npx intlayer content test
```

Optional: run the CLI audit for a human-readable summary alongside tests:
Expand Down
25 changes: 19 additions & 6 deletions docs/docs/en/testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
createdAt: 2025-03-01
updatedAt: 2026-09-27
updatedAt: 2026-10-27
priority: 8
title: "Testing Your Translations with Intlayer"
description: "Test your Intlayer content: detect missing translations, validate dictionaries in CI and render components per locale in unit tests."
Expand All @@ -15,6 +15,9 @@ slugs:
- doc
- testing
history:
- version: 6.1.0
date: 2026-10-27
changes: "Clarify that content test exits non-zero on missing required locales"
- version: 6.0.1
date: 2025-10-05
changes: "Make test async and add build option"
Expand All @@ -32,7 +35,7 @@ This guide shows how to automatically verify your dictionaries are complete, cat

- **Missing translations**: fail CI if any required locales are missing for any dictionary.
- **Localized UI rendering**: render components with a specific locale provider and assert on visible text/attributes.
- **Build-time audits**: run a quick audit locally via CLI.
- **Build-time audits**: run `npx intlayer content test` locally or in CI; it exits non-zero when required translations are missing.

## Quick start: audit via CLI

Expand Down Expand Up @@ -63,7 +66,7 @@ Useful flags:
- `--prefix [label]`: prefix log lines.
- `--build [build]`: build the dictionaries before testing to ensure the content is up to date. True will force the build, false will skip the build, undefined will allow using the cache of the build.

Note: the CLI prints a detailed report but does not exit non‑zero on failures. For CI gating, add a unit test (below) that asserts zero missing required locales.
The command exits with code `1` when any required locale is missing (see `requiredLocales` in your configuration), and `0` otherwise. You can use it directly to fail CI jobs or commit hooks. The programmatic test below is an optional alternative.

## Programmatic test (Vitest/Jest)

Expand Down Expand Up @@ -160,14 +163,24 @@ Tips:

## Continuous Integration

Add a test that fails the build when required translations are missing.
Run the CLI audit in CI. It fails the job when required translations are missing.

`package.json`:

```json
{
"scripts": {
"test:i18n": "vitest run -c"
"test:i18n": "npx intlayer content test"
}
}
```

Alternative: Vitest

```json
{
"scripts": {
"test:i18n": "vitest run"
}
}
```
Expand All @@ -186,7 +199,7 @@ jobs:
with:
node-version: 20
- run: npm ci
- run: npm run test:i18n
- run: npx intlayer content test
```

Optional: run the CLI audit for a human-readable summary alongside tests:
Expand Down
25 changes: 19 additions & 6 deletions docs/docs/es/testing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
createdAt: 2025-03-01
updatedAt: 2025-09-20
updatedAt: 2026-10-27
priority: 8
title: "Probar tus traducciones con Intlayer"
description: "Prueba tu contenido de Intlayer: detecta traducciones que faltan, valida los diccionarios en CI y renderiza componentes por locale en tus tests."
Expand All @@ -15,6 +15,9 @@ slugs:
- doc
- testing
history:
- version: 6.1.0
date: 2026-10-27
changes: "Aclarar que content test termina con un código distinto de cero cuando faltan locales requeridos"
- version: 6.0.0
date: 2025-09-20
changes: "Introducción de pruebas"
Expand All @@ -29,7 +32,7 @@ Esta guía muestra cómo verificar automáticamente que tus diccionarios estén

- **Traducciones faltantes**: falla en CI si faltan locales requeridos en cualquier diccionario.
- **Renderizado de UI localizada**: renderiza componentes con un proveedor de locales específico y verifica el texto/atributos visibles.
- **Auditorías en tiempo de compilación (build time)**: ejecuta una auditoría rápida localmente vía CLI.
- **Auditorías en tiempo de compilación (build time)**: ejecuta `npx intlayer content test` localmente o en CI; termina con un código distinto de cero cuando faltan traducciones requeridas.

## Inicio rápido: auditoría vía CLI

Expand Down Expand Up @@ -59,7 +62,7 @@ Flags útiles:
- `--verbose`: muestra registros detallados.
- `--prefix [etiqueta]`: prefija las líneas de registro.

Nota: la CLI imprime un informe detallado pero no termina con un código distinto de cero en caso de fallos. Para control en CI, añade una prueba unitaria (más abajo) que verifique que no hay locales requeridos faltantes.
El comando termina con el código `1` cuando falta cualquier locale requerido (consulta `requiredLocales` en tu configuración), y con `0` en caso contrario. Puedes usarlo directamente para hacer fallar trabajos de CI o hooks de commit. La prueba programática de abajo es una alternativa opcional.

## Prueba programática (Vitest/Jest)

Expand Down Expand Up @@ -155,14 +158,24 @@ Consejos:

## Integración Continua

Agrega una prueba que falle la compilación cuando falten traducciones requeridas.
Ejecuta la auditoría CLI en CI. Hace fallar el trabajo cuando faltan traducciones requeridas.

`package.json`:

```json
{
"scripts": {
"test:i18n": "vitest run -c"
"test:i18n": "npx intlayer content test"
}
}
```

Alternativa: Vitest

```json
{
"scripts": {
"test:i18n": "vitest run"
}
}
```
Expand All @@ -181,7 +194,7 @@ jobs:
with:
node-version: 20
- run: npm ci
- run: npm run test:i18n
- run: npx intlayer content test
```

Opcional: ejecuta la auditoría CLI para un resumen legible por humanos junto con las pruebas:
Expand Down
Loading
Loading