0.4.0 • Published 2 years ago

vite-plugin-i18next-scanner v0.4.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

vite-plugin-i18next-scanner

Automatically find and export translation keys when editing.

Install

with yarn:

yarn add -D vite-plugin-i18next-scanner

or with pnpm:

pnpm add -D vite-plugin-i18next-scanner

Usage

Add this plugin to your vite.config.js:

import { defineConfig } from 'vite';
import { i18nextScanner } from 'vite-plugin-i18next-scanner';

export default defineConfig({
  plugins: [
    //...
    i18nextScanner({
      langs: ['en', 'zh'],
    }),
  ],
});

Options

export interface PluginOptions {
  // Language files to be generated. default is [`en`]
  langs?: string[];

  // Files to be scanned, support glob pattern. default is `[./src/**/*.{ts,tsx,js,jsx}]`
  includes?: string[];

  // it will generate `{langs}.json` files under `outDir`, default is `./locales`
  outDir?: string;
}