Astro
The official @sonenta/astro integration pulls your released translation bundles from the Sonenta CDN at build time and inlines them into your static HTML: zero client JS, pure SSG, no flash of untranslated content. This site runs on it.
1. Create a project & get your keys
Section titled “1. Create a project & get your keys”Sign in, create a project, and copy its UUID. You manage keys and translations in Sonenta: by talking to your agent over MCP, with the CLI, or in the dashboard.
Open the dashboard · MCP setup
2. Install the package
Section titled “2. Install the package”Add the official Astro integration:
npm install @sonenta/astro3. Add the integration
Section titled “3. Add the integration”Register it in astro.config.mjs with your project UUID, locales, and namespaces. Bundles are fetched once at build (locale × namespace). Extra options: version (default "main"), cdnBase, and fallbackLng.
import { defineConfig } from "astro/config";import sonenta from "@sonenta/astro";
export default defineConfig({ integrations: [ sonenta({ project: "<your-project-uuid>", locales: ["en", "fr"], defaultLocale: "en", // source / fallback locale namespaces: ["common"], }), ],});4. Use getT() in your pages
Section titled “4. Use getT() in your pages”Import getT from the sonenta:i18n virtual module and bind it to a locale. Pass any locale you like: it works with Astro's native i18n routing or your own. Address other namespaces with the "ns:key" syntax (e.g. t("docs:intro")); strings are inlined into the static HTML:
---import { getT } from "sonenta:i18n";const t = getT(Astro.currentLocale ?? "en");---<h1>{t("home.title")}</h1><p>{t("home.greeting", { name: "Ada" })}</p>5. Publish, then rebuild
Section titled “5. Publish, then rebuild”Manage source strings in Sonenta and publish a release (via your agent, the CLI, or the dashboard). The next astro build picks up the latest bundle:
# push your source strings to Sonenta + publish a releasenpx @sonenta/cli push # or let your agent do it over MCP