0.1.0 • Published 12 months ago

vite-auto-i18n v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

vite-auto-i18n

Auto wrap up i18n function

NPM version NPM Downloads

  • React
  • Vue with .tsx
  • Vue with .vue

Install

npm i -D vite-auto-i18n

Usage

import autoI18n from 'vite-auto-i18n'

export default {
  plugins: [
    autoI18n(/* options */)
  ]
}

Example

See 👉🏻 example

API

export interface I18nOptions {
  filter?: (text: string, id: string) => boolean | void
  filterFile?: (id: string) => boolean | void
  /**
   * @default '@/i18n'
   */
  importPath?: (id: string) => string
  /**
   * @default 'default'
   */
  importMember?: (id: string) => string
  /**
   * @default '_i18n_t_'
   */
  i18nFnName?: (id: string) => string
}