π Generate translations in files for your project using cli. Support ts, js and json extensions. π
-
Install package using npm or yarn.
npm install translations-generator --save-dev
or
yarn add translations-generator -D
-
Add
translations.config.json
file to root of your directory.{ ext: "js", // "ts", "js" or "json" (extention of translations), path: "src/translations", // path to folder with translations pattern: "translatations_", // (optional) specify pattern to use "en" instead of "translatations_en" alias: { "en": "translatations_en", // (optional) you can use "en" to specify translation } }
Run command for adding translation to files
translations-generator
Run command for removing translation from files
translations-generator --remove-label
.
βββ src
β βββtranslations
β βββ translation_en.js
β βββ translation_de.js
β βββ translation_nl.js
β β...
β βββcomponents
β βββ....
βββ README.md
βββ translations.config.json
β...
// translation_en.js
export default {
"title": "Title",
};
Run translations-generator
You'll see
Enter translations you want to use: (empty is all)
Enter a label: description
Enter a text: Description
Output
// translation_en.js
export default {
"title": "Title",
"description": "Description",
};
Generated files are ready! π
Feel free contribute to the project. More information you can find in CONTRIBUTING file.
MIT βΒ See LICENSE file.