SDK Overview
Add runtime translations to your app by wrapping strings. No translation keys, no locale files, no configuration.
The Babelize SDK is the simplest way to localize any JavaScript application. Instead of maintaining translation keys, locale JSON files, and complex i18n configurations, you simply wrap any string with babelize() and the SDK handles everything else.
import { babelize } from "@babelize/sdk";
babelize.init(process.env.BABELIZE_API_KEY);
<h1>{babelize("Welcome")}</h1>
<p>{babelize("Hello {name}", { name: user.name })}</p>How It Works
The SDK operates in two modes:
Build time — A plugin (@babelize/vite or @babelize/next) scans your source code for babelize() calls, extracts all strings, and sends them to the Babelize API for translation. The translations are saved in babelize-lock.json.
Runtime — When your app runs, the SDK loads the lockfile and uses it for instant translations. If a string isn't in the lockfile (dynamic content), the SDK fetches it from the API in the background and updates the UI when the translation arrives.
Build Time:
Scan source → Extract strings → API translates → babelize-lock.json
Runtime (dev):
babelize("Welcome") → check cache → check lockfile → API fallback → re-render
Runtime (production):
babelize("Welcome") → check cache → check lockfile → instant translationPackages
| Package | Description |
|---|---|
@babelize/sdk | Core runtime — translate strings, cache, locale detection |
@babelize/sdk-react | React bindings — provider, hooks, <BabelizeTag> |
@babelize/sdk-next | Next.js integration — middleware, server components |
@babelize/vite | Vite build plugin — auto-discover strings at build time |
@babelize/next | Next.js build plugin — auto-discover strings during next build |
SDK vs CLI
The CLI (@babelize/cli) is designed for batch translation of your entire project — scanning files, uploading to Babelize, and downloading translated locale files. It's a one-time or CI-driven workflow.
The SDK is designed for runtime translation within your application — strings are translated on the fly, cached locally, and served without any additional developer effort. You don't manage locale files, run commands, or configure projects.
Use the SDK when you want localization to feel like using JavaScript. Use the CLI when you need full control over the translation pipeline.
Last updated: 2026-07-30