Skip to content
F fluenti

Translating Content

Fluenti offers three ways to translate content, all processed at compile time for zero runtime parsing overhead.

The v-t directive is the primary API for translating Vue template content. It’s a compile-time nodeTransform, not a runtime directive.

<h1 v-t>Welcome to Fluenti</h1>

Transformed at build time into:

<h1>{{ $t('Welcome to Fluenti') }}</h1>

Vue template expressions inside v-t elements are extracted as ICU variables:

<p v-t>Hello {{ name }}, welcome back!</p>
<p v-t>{{ greeting }} {{ name }}, you have {{ count }} items</p>

Use the argument syntax to set a custom message ID:

<p v-t:nav.home>Home</p>
<p v-t:app.checkout.title>Checkout</p>

Output: <p>{{ $t('nav.home') }}</p>

Use the .plural modifier with pipe-separated forms:

<p v-t.plural="count">no items | one item | {{ count }} items</p>

This extracts an ICU plural message: {count, plural, one {one item} other {{count} items}}

Child HTML elements are preserved:

<p v-t>Read the <a href="/terms">terms</a> and <strong>conditions</strong></p>

Use modifiers to translate element attributes:

<img v-t.alt src="/hero.jpg" alt="Welcome banner image" />
<input v-t.placeholder placeholder="Search products..." />
<a v-t v-t.title href="/terms" title="Read our terms">Terms of Service</a>

The v-t directive is processed at compile time by the Vite plugin’s nodeTransform. It never reaches the browser — it’s converted to $t() calls during the build. See How It Works for the full compilation pipeline.

The t() function is a compile-time macro for use in <script setup> and template expressions.

<script setup>
import { useI18n } from '@fluenti/vue'
const { t } = useI18n()
</script>
<template>
<p>{{ t('Welcome to Fluenti') }}</p>
<p>{{ t('Hello, {name}!', { name: userName }) }}</p>
</template>

In SolidJS:

const { t } = useI18n()
return <p>{t('Welcome to Fluenti')}</p>

The Vite plugin transforms t() calls at build time:

// Input
const greeting = t('Hello, {name}!', { name })
// Output (Vue)
const greeting = __i18n.t('_hash123', { name: unref(name) })
// Output (Solid)
const greeting = __i18n.t('_hash123', { name: name() })
Featuret()v-t
WhereScript + template expressionsTemplate elements only
InterpolationVia values objectVia {{ variable }}
Rich textVia <Trans :message="t(...)">Automatic child extraction
Explicit IDt('id') (source text = key)v-t:explicit.id

The t tagged template is a compiler macro for reactive translations in <script setup>. You never import it — the Vite plugin injects the necessary imports automatically.

<script setup>
const pageTitle = t`Welcome to Fluenti`
const greeting = t`Hello ${name}, you have ${count} items`
</script>
<template>
<h1>{{ pageTitle }}</h1>
<p>{{ greeting }}</p>
</template>
// Input
const greeting = t`Hello ${name}`
// Output (Vue)
const greeting = computed(() => __i18n.t('Hello {name}', { name: unref(name) }))
// Output (Solid)
const greeting = createMemo(() => __i18n.t('Hello {name}', { name: name() }))
ExpressionICU PlaceholderValue
${name}{name}unref(name)
${user.name}{name}unref(user.name)
${user.profile.displayName}{displayName}unref(user.profile.displayName)
${getName()}{0}getName()
${a + b}{0}a + b

Rules: Simple identifier uses the name as placeholder. Property access uses the last segment. Everything else gets positional {0}, {1}, etc.

  • Vue: Returns a ComputedRef — automatically updates when any referenced reactive value changes.
  • Solid: Returns a createMemo — similarly reactive.