Validátor i18n
Lintujte soubory překladů na chybějící klíče, poškozené zástupné symboly a nekonzistence v plurálech. Jeden příkaz. 9 kontrol. 32 formátů. Bez konfigurace.
Problém
Chyby v překladech jsou neviditelné, dokud na ně uživatelé nenarazí. Chybějící klíč zobrazí syrovou cestu jako "settings.billing.title" místo skutečného textu. Poškozený zástupný symbol vykreslí "{price}" jako doslovný text místo "$9.99". Neplatný plurál spadne, když je počet nula. Tyto chyby projdou code review, protože nikdo ručně nedifuje 15 souborů lokalizací.
Missing keys
Blank text or key paths shown to users
Broken placeholders
{price} displays as literal text instead of $9.99
Orphaned files
Outdated translations confuse the build system
Malformed files
Runtime crashes when users switch languages
Řešení
i18n-validate projde všechny Vaše soubory překladů na jeden zátah. Automaticky zjistí rozložení adresářů a formát souborů, porovná každý jazyk s referencí a přesně nahlásí, co je špatně a kde. Žádné pluginy, žádná konfigurace, žádný vlastní testovací kód.
| Check | Severity | What it catches |
|---|---|---|
| missing-keys | error | Key exists in reference but is absent in a translation |
| extra-keys | error | Key exists in translation but not in the reference |
| placeholders | error | {price}, {{name}}, %s differ between languages |
| plural-structure | error | Plural forms are malformed or missing required categories |
| missing-languages | error | Expected language has no files or directory |
| orphaned-languages | error | Language files exist but are not in the expected list |
| parse-errors | error | File fails to parse (broken JSON, XML, YAML, etc.) |
| empty-values | warning | Key is present but the translation is an empty string |
| untranslated | warning | Translation is identical to the reference language |
i18n-validate v0.1.0 — validating ./locales
Reference: en (2 files: translation.json, apiTester.json)
Languages: de, ja, fr, es, zh-Hans, pt-BR, ko (7 found, 7 expected)
Layout : directory (auto-detected)
Formats : i18next JSON (auto-detected)
────────────────────────────────────────────────
ERRORS (5)
✗ missing-keys │ translation.json
Key "settings.billing.title"
missing in: ja, ko
✗ placeholders │ translation.json
Key "pricing.total" — expected: {price}, {currency}
de: found {price} only — missing {currency}
────────────────────────────────────────────────
WARNINGS (2)
⚠ empty-values │ translation.json
Key "onboarding.step3.hint"
empty in: de, fr
────────────────────────────────────────────────
5 errors, 2 warnings across 7 languages
✗ Validation failedInstalace
Nainstalujte jako globální CLI nástroj pomocí preferovaného správce balíčků. Balíček npm obsahuje nativní binární soubor v Rustu — nejsou potřeba žádná kompilace ani runtime závislosti.
npm install -g @i18n-agent/i18n-validatePoužití
Nasměrujte nástroj na adresář s lokalizacemi. Automaticky zjistí referenční jazyk, rozložení adresářů a formát souborů. Ve většině projektů není potřeba žádná konfigurace.
# Zero-config validation
i18n-validate ./locales
# JSON output for scripting
i18n-validate ./locales --format json | jq '.summary'
# CI/CD with JUnit XML
i18n-validate ./locales --format junit -o i18n-report.xmlIntegrace CI/CD
Přidejte validaci překladů do pipeline pro pull requesty. Nástroj generuje JUnit XML, které se integruje s test reportery v GitHub Actions, artefakty v GitLab CI a jakýmkoli CI systémem, který podporuje JUnit.
name: Validate Translations
on:
pull_request:
paths: ['locales/**', 'public/locales/**']
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate translations
run: npx @i18n-agent/i18n-validate ./locales --format junit -o i18n-report.xml
- uses: dorny/test-reporter@v1
if: always()
with:
name: i18n validation
path: i18n-report.xml
reporter: java-junit--strict to also fail on warnings.Podporované formáty
Validátor je postavený na i18n-convert a ve výchozím stavu podporuje 32 formátů i18n souborů. Nejsou potřeba žádné pluginy ani konfigurace pro konkrétní formát — nástroj formát automaticky detekuje podle přípon a obsahu souborů.
Mobile & Desktop
Android XML, Xcode String Catalog, iOS Strings, iOS Stringsdict, Flutter ARB, Qt Linguist
Web & Frameworks
Structured JSON, i18next JSON, JSON5, HJSON, YAML (Rails), YAML (Plain), JavaScript, TypeScript, PHP/Laravel, NEON
Standards & Exchange
XLIFF 1.2, XLIFF 2.0, Gettext PO, TMX, .NET RESX, Java Properties
Data & Other
CSV, Excel (.xlsx), TOML, INI, SRT Subtitles, Markdown, Plain Text
Konfigurace
Ve většině projektů funguje vše bez konfigurace. Když potřebujete mít věci pod kontrolou — přepsat závažnost kontrol, nastavit očekávané jazyky nebo vyloučit jazyky ve fázi WIP — vytvořte v kořeni projektu soubor .i18n-validate.toml.
# .i18n-validate.toml
ref = "en"
expect = ["de", "ja", "fr", "es", "zh-Hans", "pt-BR", "ko"]
[checks]
missing-keys = "error"
extra-keys = "error"
placeholders = "error"
empty-values = "warning"
untranslated = "warning"
[languages.ko]
missing-keys = "warning" # Korean is WIP
[languages.ar]
skip = true # Exclude from validationVyzkoušejte i18n Agent nyní
Sem přetáhněte svůj překladový soubor
JSON, YAML, PO, XML, CSV, Markdown, Properties
nebo klikněte a vyberte soubor
Cílové jazyky