translation-key-purge
v1.0.7
Published
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
Downloads
397
Maintainers
Readme
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
Create a
sumit.config.json
file in the root of your project with the desired configuration.Add the following script to your
package.json
:
"scripts": {
"check-keys": "translation-key-purge start"
}
- Run the script in your
terminal
:
npm run check-keys
- 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