Skip to content
F fluenti

@fluenti/vite-plugin

vite.config.ts
import { defineConfig } from 'vite'
import fluenti from '@fluenti/vite-plugin'
export default defineConfig({
plugins: [fluenti()],
})
fluenti({
framework: 'auto', // 'vue' | 'solid' | 'auto'
catalogDir: 'src/locales/compiled',
configPath: './fluenti.config.ts',
})
OptionTypeDefaultDescription
framework'vue' | 'solid' | 'auto''auto'Framework detection mode
catalogDirstring'src/locales/compiled'Compiled catalogs directory
configPathstring?Path to fluenti config

The plugin provides five sub-plugins:

  1. fluenti:virtual — Resolves virtual:fluenti/messages/{locale} imports
  2. fluenti:vue-template — Pre-transforms v-t directives in Vue SFCs
  3. fluenti:script-transform — Transforms t\`andt()` macros in scripts
  4. fluenti:build-split — Code-splitting transforms for production builds
  5. fluenti:dev — HMR support for catalog changes
import messages from 'virtual:fluenti/messages/en'
import messages from 'virtual:fluenti/messages/zh-CN'

The plugin transforms tagged template and function call macros at build time.

Vue mode:

t`Hello ${name}` → computed(() => __i18n.t('hash', { name: unref(name) }))

Solid mode:

t`Hello ${name()}` → createMemo(() => __i18n.t('hash', { name: name() }))