translate-kit

Getting Started

Install and set up translate-kit in your project.

Install translate-kit

bun add translate-kit

Install 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/openai

Then 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-intl

Follow 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 init

This wizard will:

  1. Ask you to choose a translation mode — keys or inline
  2. Ask you to choose an AI provider
  3. Configure source and target locales
  4. Set up your messages directory
  5. Generate a translate-kit.config.ts file
  6. For inline mode: copy the <T> component and set up I18nProvider
  7. 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 translate

This 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.