i18next-keys-extractor is a library to help you automatically extract and generate locale files for your i18n translations. It searches for translation keys in your project's source code and generates locale JSON files for the specified languages.
- Support for JavaScript, TypeScript, React, and JSX files
- Customizable locales and output directory
- Easy integration with your build process
- Simple CLI interface
npm install i18next-keys-extractorTo use the CLI, simply run:
i18next-keys-extractor --locales en,es,fr --folder srcYou can also use the library programmatically in your Node.js application:
import { extractKeys } from "i18next-keys-extractor";
extractKeys({
supportedExtensions: ["js", "jsx", "ts", "tsx"],
localesDir: "./locales",
locales: ["en", "es", "fr"],
folder: "./src",
});supportedExtensions(Array): List of supported file extensions. Default:["js", "jsx", "ts", "tsx"]localesDir(String): The output directory for the generated locale files. Default:./localeslocales(Array): List of locales to generate. Default:["en"]folder(String): The root folder to search for translation keys. Default:./
This project is licensed under the MIT License.