npm.io
0.4.1 • Published yesterday

@intl-ai/api

Licence
MIT
Version
0.4.1
Deps
6
Size
221 kB
Vulns
0
Weekly
0
Stars
1

intl-ai

AI-powered i18n translation plugin for all bundlers

npm CI License: MIT GitHub stars

Documentation · Roadmap · Discussions · Report an issue

Automatically translate your app with AI. intl-ai hooks into your build pipeline to generate and update translations on every build, with no changes to your runtime code.

intl-ai demo

Why intl-ai

Most i18n translation workflows are manual (copy JSON, open a translation tool, paste back) or runtime-heavy (call an AI API on every page load). intl-ai runs at build time so translations are baked in before your app ships.

  • Zero runtime overhead. Translations happen during the build, not in the browser or on the server.
  • Any bundler. Vite, Rollup, Webpack, esbuild, Rspack, Bun, Nuxt, Next.js (including Turbopack).
  • Any AI provider. Vercel AI SDK compatible: OpenAI, Anthropic, Google, any OpenAI-compatible endpoint.
  • Lockfile-tracked origins. intl-ai.lock.json records whether each translation was written by a human or generated by AI, so you always know what to trust and what to review.
  • Incremental. Only missing or stale keys are re-translated. Existing human-edited strings are never overwritten unless you pass --force.

Vs. manual translation

Manual translation requires copy-pasting JSON, running a translation tool, and re-integrating the result. intl-ai replaces this loop with a single intl-ai fill run (or an automatic pass on every build).

Vs. runtime AI translation

Runtime translation calls the AI API on every request. This adds latency and cost, and makes translations non-deterministic across deployments. intl-ai translates once at build time and commits the result, so production strings are stable and auditable.

Install

Vite / Rollup / Webpack / esbuild / Rspack

npm install -D @intl-ai/unplugin

Next.js

npm install -D @intl-ai/next

CLI only

npm install -D @intl-ai/cli

Create a config file

intl-ai reads intl-ai.config.ts (or .json) at your project root.

{
  "$schema": "https://www.schemastore.org/intl-ai.json",
  "defaultLocale": "en",
  "locales": ["en", "es", "fr"],
  "localeDir": "./locales",
  "model": "your-provider/your-model",
  "apiKey": "${OPENAI_API_KEY}"
}
TypeScript config (when you need a live AI SDK model instance)
// intl-ai.config.ts
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";

const openai = createOpenAICompatible({
  name: "openai",
  baseURL: "https://api.openai.com/v1",
  apiKey: process.env.OPENAI_API_KEY,
});

export default {
  model: openai("your-model-name"),
  defaultLocale: "en",
  locales: ["en", "es", "fr"],
  localeDir: "./locales",
};

See Configuration for the full schema.

Usage

Vite
// vite.config.ts
import { defineConfig } from "vite";
import IntlAi from "@intl-ai/unplugin/vite";

export default defineConfig({
  plugins: [IntlAi()],
});
Next.js
// next.config.ts
import withIntlAi from "@intl-ai/next";

export default withIntlAi({
  // your existing Next.js config
  reactStrictMode: true,
});
CLI
npx intl-ai fill

Packages

Package Description Registry
@intl-ai/api Runtime-agnostic core npm
@intl-ai/unplugin Universal bundler plugin npm
@intl-ai/next Next.js integration npm
@intl-ai/cli intl-ai fill / check npm

License

MIT