1.0.3 • Published 1 year ago

@byldrma3/translint v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TransLint

A lightweight utility to detect missing translation keys across multiple language files.

Features

  • Flattens nested translation objects
  • Compares translation keys across all languages
  • Identifies missing translations for each language
  • Returns a clear status report

Installation

npm install @byldrma3/translint
# or
yarn add @byldrma3/translint

Usage

import { TransLint } from '@byldrma3/translint';

const languages = {
  en: {
    common: {
      hello: 'Hello',
      welcome: 'Welcome'
    }
  },
  fr: {
    common: {
      hello: 'Bonjour'
      // 'welcome' key is missing
    }
  }
};

const result = TransLint(languages);
console.log(result);
// Output:
// {
//   result: [
//     {
//       language: 'fr',
//       keys: ['common.welcome']
//     }
//   ],
//   status: false
// }

Return Value

  • result: Array of missing translations per language (null if all translations are complete)
  • status: Boolean indicating if all translations are complete

License

MIT © MIT license

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago