Skip to content

Latest commit

 

History

History
77 lines (60 loc) · 2.09 KB

README.md

File metadata and controls

77 lines (60 loc) · 2.09 KB

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