2.0.3 • Published 3 years ago
git18n v2.0.3
Lightweight utility that automates translations management using react-intl (FormatJS).
Installation
yarn add -D git18nOr with npm:
npm install --save-dev git18n(Node version 16.5 or higher).
How to use:
Retrieve access token on git18n.com and set as environment variable (
GIT18N_SECRET_PROJECT_KEY="your-app-key")Add
translatecommand topackage.json:
"scripts": {
"translate": "git18n --files 'src/**/*.js*'"
}Default values for --files and --ignore are:
const DEFAULT_FILES_ARG = '(components|containers|pages|src|modules)/**/*.{ts,tsx,js,jsx}';
const DEFAULT_IGNORE_ARG = '**/*.d.ts';Additional arguments:
--cleanremoves translation IDs not present in code--prettyLocaleformats locale files with line-breaks
- Run
yarn translateto add new translations (i.e. when submitting a pull request) and when deploying (as part of the build process, e.g.yarn translate && yarn build).
There is no need to yarn translate during development since it just uses the defaultMessage as fallback.
Note: Full docs: https://docs.git18n.com
Please submit questions or bugs to: https://github.com/lassegit/git18n-node