1.0.7 • Published 1 year ago

translation-key-purge v1.0.7

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

Translation Key Purge

A tool to automatically detect and remove unused translation keys from i18n files across multiple projects, helping maintain clean and efficient localization in React.js and Next.js.

Features

  • Detect unused translation keys in your project.
  • Remove unused translation keys from JSON files.
  • Supports React.js and Next.js projects.

Installation

You can install the package using npm:

npm install translation-key-purge

Or using yarn:

yarn add translation-key-purge

Configuration

Create a sumit.config.json file in the root of your project to customize the behavior of the package.

{
  "functionName": "t",
  "languageCode": "en",
  "searchPath": "src"
}
  • functionName: The function name used for translation keys in your code (default: t).

  • languageCode: The language code for the JSON file to check (default: en).

  • searchPath: The searchPath for the JSON file source folder path to check (default: src).

Usage

  1. Create a sumit.config.json file in the root of your project with the desired configuration.

  2. Add the following script to your package.json:

"scripts": {
  "check-keys": "translation-key-purge start"
}
  1. Run the script in your terminal:
npm run check-keys
  1. Follow the prompts to remove unused translation keys.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Sumit Mayani