ngx_translate_lint_rs

Crates.iongx_translate_lint_rs
lib.rsngx_translate_lint_rs
version0.1.4
created_at2025-11-18 15:02:27.777368+00
updated_at2025-11-18 15:38:09.989515+00
descriptionHigh-performance Rust port of ngx-translate-lint - check translation files in Angular/ngx-translate projects
homepagehttps://github.com/hafnerpw/rust-ngx-translate-lint
repositoryhttps://github.com/hafnerpw/rust-ngx-translate-lint
max_upload_size
id1938555
size123,993
Hafner (hafnerpw)

documentation

README

rust-ngx-translate-lint

A Rust port of ngx-translate-lint for improved performance.

Installation

npm install -g rust-ngx-translate-lint

Requirements: Rust toolchain must be installed on your system.

Usage

Command Line

ngx-translate-lint -p <project_path> -l <languages_path> -v <views_path>

Configuration File

You can also use a configuration file (JSON or JS):

ngx-translate-lint -c config.json

Example config.json:

{
  "rules": {
    "keysOnViews": "error",
    "zombieKeys": "warning",
    "misprintKeys": "warning",
    "deepSearch": "enable",
    "emptyKeys": "warning",
    "maxWarning": "6",
    "misprintCoefficient": "0.9",
    "ignoredKeys": [
      "library.targetSystem.*",
      "engineering.signal_configurations.behavior.*",
      "languages.*"
    ],
    "ignoredMisprintKeys": [
      "common.button.*",
      "validation.messages.*"
    ]
  },
  "project": "./src/app/**/*.{html,ts}",
  "languages": "./src/assets/i18n/*.json"
}

Example config.js:

module.exports = {
  rules: {
    keysOnViews: 'error',
    zombieKeys: 'warning',
    misprintKeys: 'warning',
    deepSearch: 'enable',
    emptyKeys: 'warning',
    maxWarning: '6',
    misprintCoefficient: '0.9',
    ignoredKeys: [
      'library.targetSystem.*',
      'engineering.signal_configurations.behavior.*',
      'languages.*'
    ],
    ignoredMisprintKeys: [
      'common.button.*',
      'validation.messages.*'
    ]
  },
  project: './src/app/**/*.{html,ts}',
  languages: './src/assets/i18n/*.json'
};

Options

  • -p, --project - Path to the project
  • -l, --languages - Path to directory with translation files (JSON), supports glob patterns
  • -v, --views - Path to directory with view files (HTML/TS), supports glob patterns
  • -c, --config - Path to configuration file (JSON or JS)
  • -z, --zombies - Remove unused translation keys
  • -m, --misprintCoefficient - Threshold for detecting potential misprints (default: 0.9)
  • --maxWarning - Maximum allowed warnings before exiting with error code
  • --ignoreKeys - Comma-separated list of keys to ignore (supports wildcards like prefix.*)
  • --ignoreMisprintKeys - Comma-separated list of keys to ignore for misprint detection
  • --deepSearch - Enable deep search mode (slower but more thorough)
  • --customRegex - Custom regex pattern for key extraction

Features

  • Detects missing translation keys
  • Finds unused translation keys (zombies)
  • Identifies potential typos in translation keys
  • Supports wildcard patterns for ignored keys
  • Supports glob patterns for file paths
  • Configuration file support (JSON/JS)
  • Fast performance thanks to Rust

Examples

Basic Usage

ngx-translate-lint -p ./ -l ./src/assets/i18n -v ./src/app

With Glob Patterns

ngx-translate-lint -l "./src/assets/i18n/*.json" -v "./src/app/**/*.{html,ts}"

With Configuration File

ngx-translate-lint -c ngx-translate-lint.config.json

Remove Zombie Keys

ngx-translate-lint -p ./ -l ./src/assets/i18n -v ./src/app -z

Deep Search Mode

ngx-translate-lint -p ./ -l ./src/assets/i18n -v ./src/app --deepSearch

Ignore Specific Keys

ngx-translate-lint -l "./src/assets/i18n/*.json" -v "./src/app/**/*.ts" --ignoreKeys "library.*,engineering.signal.*"

License

MIT

Commit count: 0

cargo fmt