Languine can work together with Prettier to ensure your translation files are consistently formatted. This is particularly useful when working with JSON translation files that need to maintain a consistent style across your project.
The recommended way to use Prettier with Languine is to format your translation files after they're generated. You can set this up in your package.json
:
{ "scripts": { "translate": "languine translate", "format": "prettier --write \"locales/**/*.json\"", "translate:format": "npm run translate && npm run format" } }
Now you can:
npm run translate
to only generate translationsnpm run format
to only format existing translation filesnpm run translate:format
to generate translations and format them in sequence