Skip to content

vladavoX/react-i18next-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


react-i18next-validator

react-i18next validator. Validate there are no duplicate keys in translation files. Validate there are no missing keys in code that are provided in translation files. Validate there are no missing keys in translation files that are provided in code files.
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contributing
  4. License

About The Project

Stop cluttering translation.json files with keys that are no longer used or duplicate values. Make sure you don't forget to add a key to the translation file when you add it to the code. Make sure you don't forget to remove a key from the translation file when you remove it from the code.

(back to top)

Getting Started

Installation

  1. Install package
npm install react-i18next-validator --save-dev
yarn add -D react-i18next-validator
  1. Create config file in root directory ri18next-v.config.js
export const config = {
	directory: './public/locales/',
	src: './src/'
}
  1. Add script to package.json
"scripts": {
  "ri18next-v": "ri18next-validator"
}
  1. Run script
npm run ri18next-v
yarn ri18next-v
  1. You can add additional options to the config
export const config = {
	errorLevel: 'error', // error, warn, info
	regex: [/someRegex/g], // RegExp[] array of regex to look for in code files to match translation keys
	ignoreKeys: ['foo', 'bar'] // string[] array of keys to ignore
}

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)