Caratteristica

Translation Quality Assurance: Automated Checks at Scale

Keeping Your Translations Consistent

Translation quality is not just about getting the words right -- it is about making sure every key is accounted for, unused keys are cleaned up, and your terminology stays consistent across languages. Better i18n provides several tools that work together to maintain translation quality across your project.

CLI Scan: Catching Hardcoded Strings

The first line of defense is the scan command. It parses your codebase using AST analysis to find strings that should be translated but are not wrapped in translation functions.

better-i18n scan --dir ./src

The scanner detects:

  • Hardcoded JSX text (<h1>Hello</h1>)
  • Hardcoded JSX attributes (<img alt="Logo" />)
  • Toast and notification strings
  • Locale-dependent ternary expressions
  • String variables containing user-facing text

It is smart enough to ignore CSS classes, URLs, HTML entities, and technical constants -- so the results are focused on actual translation gaps, not false positives.

Use --ci to integrate this into your build pipeline and block PRs that introduce new hardcoded strings:

npx @better-i18n/cli scan --ci

CLI Sync: Finding Missing and Unused Keys

The sync command compares your codebase's translation key usage against what exists in Better i18n's cloud:

better-i18n sync

It produces a clear report showing:

  • Missing in Remote: Keys your code uses that have not been uploaded to Better i18n yet
  • Unused in Code: Keys in Better i18n that are no longer referenced in your source code

This is invaluable after refactors -- you can immediately see which keys became orphaned and clean them up, and which new keys need translations before shipping.

The --summary flag gives you a quick health check:

better-i18n sync --summary

This shows coverage percentages (local-to-remote and remote-used) so you know at a glance how complete your translations are.

Glossary: Terminology Consistency

The Glossary enforces consistent terminology across all translations. When you define brand terms, product names, or domain-specific vocabulary in the glossary, AI translations automatically respect those definitions.

This prevents the common problem where the same concept gets translated differently across your app -- "Workspace" in one place, "Work Area" in another, and "Project Space" in a third.

Dashboard Coverage Visibility

The Better i18n dashboard shows translation coverage per language and per namespace. You can see at a glance:

  • Which languages are fully translated
  • Which namespaces have gaps
  • How many keys exist in each part of your project

This gives product managers and engineering leads a clear view of localization status without needing to run CLI commands.

CI Integration for Quality Gates

Combine scan and sync in your CI pipeline to create quality gates that prevent translation issues from reaching production:

name: i18n Quality
on: [push, pull_request]
jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npx @better-i18n/cli scan --ci
      - run: |
          npx @better-i18n/cli sync --format json \
            | jq -e '.comparison.missingCount == 0' > /dev/null || exit 1

For pre-commit hooks, scan only staged files for fast feedback:

npx @better-i18n/cli scan --staged --ci

What We Do Not Offer (Yet)

To be clear about the current scope of quality tooling:

  • No inline QA engine -- there is no real-time validation of placeholders, HTML tags, or ICU MessageFormat within the editor. The CLI catches missing translations at the code level.
  • No custom rule system -- you cannot define custom validation rules (like length limits or forbidden characters) today.
  • No placeholder validation -- the system does not check that {name} in the source appears in the translation.
  • No visual context -- quality checks operate on key/value data, not rendered UI screenshots.

These are areas we are evaluating for future development.

Getting Started

Install the CLI and run your first quality check:

npm install -g @better-i18n/cli
better-i18n scan --dir ./src
better-i18n sync --summary

Set up glossary terms in the dashboard to enforce consistency in AI translations, and integrate the CLI into your CI pipeline for automated quality gates.

Create your account to start managing translation quality across your projects.