Create i18n templates and automatically export them to your desired languages. Unplugin support.
It's basically a tool that takes a template with translation keys and syncs them to the given language. You can directly connect the outputs to the i18n libraries you use.
pnpm add -D @huntersofbook/i18n
It will be the .i18n
folder. Save there by adding en.json
, tr.json
. It will automatically create a language
folder for you and import your data there.
import i18n from '@huntersofbook/i18n/vite'
export default defineConfig({
plugins: [
i18n({
languages: ['tr', 'en', 'cn'],
}),
],
})
export default defineNuxtConfig({
modules: [
'@huntersofbook/i18n/nuxt',
],
huntersofbookI18n: {
languages: ['tr', 'en', 'cn'],
},
})
Documentation of the project is available at https://opensource.huntersofbook.com/npm/i18n.
Join our Discord channel or open an issue.
Name | Type | Default | Description |
---|---|---|---|
languages | string[] |
['tr', 'en', 'cn'] |
Languages extensions to export |
templateDir | string |
'.i18n' |
Template folder |
exportDir | string |
'language' |
Template export folder |
... soon more detail |
Node version >= 18 Pnpm version >= 7
- Clone this repository
- Open the project folder
packages/i18n
- Enable Corepack using
corepack enable
(usenpm i -g corepack
for Node.js < 16.10) - Install dependencies using
pnpm install
- Go to
i18n/packages
pnpm dev or pnpm build - Go to
i18n/playground
pnpm dev - or
packages/i18n
indev:package
|dev:playground-vite
used.
Thanks to @antfu, this project is heavily inspired by unplugin-vue-components.
MIT License © 2023-PRESENT productdevbook