Skip to content

Sumit-Mayani/translation-key-purge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Translation key purge

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published