i18n-check-keys
TypeScript icon, indicating that this package has built-in type declarations

0.1.12 • Public • Published

i18n-check-keys

English | 简体中文

npm npm build status

A tool to check for missing internationalization keys in a project

webpack plugin: i18n-check-keys-webpack-plugin vite plugin: vite-plugin-i18n-check-keys

Automatically checks for supported path forms

│ locales
│  ├─en
│  │  └ index.js
│  └─zh_CN
│     └ index.js
│ locales
│  ├─en.js
│  └─zh_CN.js
├─dir1
│  └─locale
|    ├─en.js
|    └─zh_CN.js
├─dir2
│  └─locale
|    ├─en.js
|    └─zh_CN.js

Install

npm i i18n-check-keys -D
# or
yarn add i18n-check-keys -D
# or
pnpm add i18n-check-keys -D

Usage

const { checkI18nKeys } = require('i18n-check-keys');

checkI18nKeys({
  localePath: /locale/,
  benchmarkLang: 'en',
}).run()

Methods

checkI18nKeys(options)

Options

Property Description Type Default
localePath language pack path RegExp /locale/
benchmarkLang base language string 'en'
languages The language to check, an empty array is all files in the checked directory string[] []
fileType file type string | string[] | RegExp 'js'
needStopRun Whether to stop the process when missing is detected boolean false

Returns

Property Description Type
run Run check, the parameter is the starting path, the default is the running path (_path = process.cwd()) => void

Package Sidebar

Install

npm i i18n-check-keys

Weekly Downloads

21

Version

0.1.12

License

ISC

Unpacked Size

60.1 kB

Total Files

9

Last publish

Collaborators

  • liuzihao0413