@i18nguard/cli
v1.0.3
Published
Command-line interface for i18nGuard
Readme
@i18nguard/cli (beta)
Command-line interface for i18nGuard.
Install
npm i -g @i18nguard/cli@betaQuick start
- Create
i18nscan.config.ts(or .js/.mjs/.cjs/.json) at project root:
export default {
library: 'i18next', // or 'formatjs' | 'lingui' | 'auto'
src: ['src/**/*.{ts,tsx,js,jsx}'],
locales: ['en', 'fr'],
defaultLocale: 'en',
catalogs: {
i18next: {
pathPattern: 'public/locales/{locale}/{ns}.json',
namespaces: ['common']
}
},
ignore: ['node_modules/**', 'dist/**'],
keygen: { strategy: 'filePathSlug', maxLen: 60 },
report: { formats: ['json'], outputDir: 'i18n-reports' }
}- Run a scan (auto-detects config):
i18nguard scan- Generate a report from a saved JSON:
i18nguard report -i i18n-reports/report.json -f html -o i18n-reports/report.htmlTroubleshooting
- If no files are scanned, adjust
srcglobs and run from your project root. - For i18next, ensure
catalogs.i18next.pathPatternuses{locale}and{ns}and points to real files. - For FormatJS, set
catalogs.formatjs.messagesGlobsto match your message JSON files with{locale}.
License
MIT
