Getting Started
Install and set up translate-kit in your project.
Install translate-kit
bun add translate-kitInstall an AI provider
translate-kit uses the Vercel AI SDK under the hood. Install the provider package for the model you want to use:
bun add @ai-sdk/openaiThen set the corresponding API key in your environment:
# .env
OPENAI_API_KEY=sk-...Any provider supported by the Vercel AI SDK works. See the full list in the AI Providers guide.
Install next-intl
translate-kit generates message files compatible with next-intl, the only i18n runtime supported at the moment. Install it as a dependency of your project:
bun add next-intlFollow the next-intl setup guide to configure routing and providers in your Next.js app. translate-kit handles the message files — next-intl handles the runtime.
Setup
Interactive Setup
The fastest way to get started is with the init command:
bunx translate-kit initThis wizard will:
- Ask you to choose a translation mode — keys or inline
- Ask you to choose an AI provider
- Configure source and target locales
- Set up your messages directory
- Generate a
translate-kit.config.tsfile - For inline mode: copy the
<T>component and set upI18nProvider - For keys mode: optionally scaffold next-intl integration
Manual Setup
Create a translate-kit.config.ts at your project root:
import { defineConfig } from "translate-kit";
import { openai } from "@ai-sdk/openai";
export default defineConfig({
model: openai("gpt-4o-mini"),
sourceLocale: "en",
targetLocales: ["es", "fr", "de"],
messagesDir: "./messages",
});Your First Translation
Create your source messages file:
// messages/en.json
{
"common": {
"save": "Save",
"cancel": "Cancel"
},
"auth": {
"login": "Log in",
"signup": "Sign up"
}
}Run the translate command:
bunx translate-kit translateThis generates messages/es.json, messages/fr.json, and messages/de.json with AI-translated content. Only new or modified keys are translated on subsequent runs.