ngx-translate-lint

raw JSON →
1.26.5 verified Fri May 01 auth: no javascript

CLI tool to validate ngx-translate translation keys in Angular applications. Version 1.26.5. Uses regex to scan templates and language files for missing keys, zombie keys, empty values, and misprints. Supports glob patterns, config files, and URL-based language files. Differentiated by deep-search and fuzzy matching features. Releases follow semantic versioning on a monthly/quarterly cadence.

error Error: Cannot find module 'ngx-translate-lint'
cause Package not installed globally or locally.
fix
Run npm install -g ngx-translate-lint for CLI, or npm install ngx-translate-lint --save-dev for programmatic use.
error ngx-translate-lint: command not found
cause Global installation may not be on PATH.
fix
Ensure npm global bin directory is in PATH, or use npx: npx ngx-translate-lint
error Error: The path to languages folder does not exist
cause Provided --languages path is incorrect or relative path does not resolve.
fix
Use absolute path or verify relative path from project root. Example: --languages ./src/assets/i18n
gotcha If using Angular 17+, ensure ngx-translate-lint version is >=1.22.0 to avoid compatibility issues.
fix Update to latest: npm install -g ngx-translate-lint@latest
gotcha When loading languages from URL, the tool does not cache responses. Repeated runs will fetch again.
fix Consider local language files for CI performance, or implement a caching proxy.
gotcha The --misprintKeys option can be very slow on large projects because it compares each key with a coefficient.
fix Only enable misprintKeys when needed, and consider increasing --misprintCoefficient to 0.95+ to reduce matches.
gotcha The --deepSearch option adds each translation key to a global regex and can be very slow.
fix Use --deepSearch disable unless you have a strong reason to scan for keys in all files.
npm install ngx-translate-lint
yarn add ngx-translate-lint
pnpm add ngx-translate-lint

Shows both CLI usage and programmatic TypeScript API for linting ngx-translate keys.

// Install globally: npm install -g ngx-translate-lint
// Run CLI with project and languages paths:
// ngx-translate-lint --project ./src --languages ./src/assets/i18n --keysOnViews error --zombieKeys warning

import { NgxTranslateLint } from 'ngx-translate-lint';

const linter = new NgxTranslateLint({
  project: './src',
  languages: './src/assets/i18n',
  keysOnViews: 'error',
  zombieKeys: 'warning',
  emptyKeys: 'disable',
  misprintKeys: 'disable',
  deepSearch: 'enable'
});

linter.lint().then(result => {
  console.log('Lint complete. Errors:', result.errors.length, 'Warnings:', result.warnings.length);
});