Auto wrap up i18n function
- [x] React
- [x] Vue with
.tsx
- [ ] Vue with
.vue
npm i -D vite-auto-i18n
import autoI18n from 'vite-auto-i18n'
export default {
plugins: [
autoI18n(/* options */)
]
}
See 👉🏻 example
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
}