i18n
Write the app in your language. No keys. Translators edit one file per locale, and each request gets its own locale.
<script setup lang="ts">
import { useLocale } from 'vite-hub/i18n/vue'
const { locale, setLocale } = useLocale()
</script>
<template>
<!-- No import and no key: write the English text -->
<h1>{{ t`Deploy your agent` }}</h1>
<p><Trans>Read the <a href="/docs">docs</a> first.</Trans></p>
<button @click="setLocale(locale === 'en' ? 'es' : 'en')">{{ locale }}</button>
</template>import { defineEventHandler, getQuery } from 'h3'
import { getLocale, plural, t } from 'vite-hub/i18n'
// No event to pass: `t` reads the locale of this request.
export default defineEventHandler((event) => {
const count = Number(getQuery(event).count ?? 1)
return {
locale: getLocale(),
message: t`Payment received`,
items: plural(count, { one: '# item', other: '# items' }),
}
}){
"hash": "5220fa743183ff60",
"source": "Deploy your agent",
"text": "Despliega tu agente",
"origin": "human",
"review": "edited",
"derived": "fresh",
"updatedAt": "2026-11-07T12:00:00.000Z"
}One locale for each request
The
locale cookie, then Accept-Language, then the source locale. Server code needs no event.IDs in production, not text
The build compiles each message to a short ID and collects the source text. Each locale is a separate chunk that loads when the page needs it.
One file for each translation
locales/ is a Diglot translations folder with one record for each message. vitehub i18n status shows what is missing, and PO files go in and out.