Quick Start (SolidJS)
-
Install packages
Terminal window pnpm add @fluenti/core @fluenti/solidpnpm add -D @fluenti/cli @fluenti/vite-plugin -
Configure Vite
vite.config.ts import { defineConfig } from 'vite'import solidPlugin from 'vite-plugin-solid'import fluenti from '@fluenti/vite-plugin'export default defineConfig({plugins: [solidPlugin(),fluenti({ framework: 'solid' }),],}) -
Create
fluenti.config.tsfluenti.config.ts import { defineConfig } from '@fluenti/cli'export default defineConfig({sourceLocale: 'en',locales: ['en', 'zh-CN'],catalogDir: './locales',format: 'po',include: ['./src/**/*.{tsx,ts}'],compileOutDir: './src/locales/compiled',}) -
Write your component — just use
t“ and<Trans>src/Home.tsx import { useI18n } from '@fluenti/solid'import { createSignal } from 'solid-js'export function Home() {const { setLocale } = useI18n()const [name] = createSignal('World')const [count] = createSignal(3)// t`` tagged template — compiler macro, no import needed// Returns a createMemo — naturally reactive with signalsconst greeting = t`Hello, ${name}!`return (<div><h1>{t`Welcome to my app`}</h1><p>{greeting()}</p>{/* Rich text with real HTML */}<Trans>Read the <a href="/docs">documentation</a> to learn more.</Trans>{/* Locale-aware plurals */}<Plural value={count()} one="# item in cart" other="# items in cart" /><button onClick={() => setLocale('en')}>English</button><button onClick={() => setLocale('zh-CN')}>中文</button></div>)}No manual keys. No JSON files. The Vite plugin injects
t`...`automatically — just use it. -
Extract messages
Terminal window npx fluenti extractThis scans your source files and generates catalog files in
./locales/. -
Add translations
Open
locales/zh-CN.poand fill inmsgstrfields:msgid "Welcome to my app"msgstr "欢迎使用我的应用"msgid "Hello, {name}!"msgstr "你好,{name}!" -
Compile messages
Terminal window npx fluenti compile -
Initialize from compiled output
src/App.tsx import { I18nProvider } from '@fluenti/solid'import { Home } from './Home'import en from './locales/compiled/en'import zhCN from './locales/compiled/zh-CN'export function App() {return (<I18nProviderlocale="en"fallbackLocale="en"messages={{ en, 'zh-CN': zhCN }}><Home /></I18nProvider>)}
Key differences from Vue
Section titled “Key differences from Vue”- Uses
<I18nProvider>instead of a plugin - Signals (
name()) instead of refs (name.value) - JSX instead of templates — use
t()directly in JSX expressions - Naturally reactive —
t()reads thelocale()signal, so JSX auto-tracks it
Rich text with <Trans>
Section titled “Rich text with <Trans>”<Trans>Click <a href="/next">here</a> to continue.</Trans><Trans>This is <strong>important</strong> information.</Trans>Plurals with <Plural>
Section titled “Plurals with <Plural>”<Plural value={count()} zero="No items" one="# item" other="# items" />Next steps
Section titled “Next steps”- SolidJS SPA guide — deeper patterns for Solid SPAs
- SolidStart — SSR with SolidStart
- Translating Content — all translation APIs