Installation
Install astro-intl using your preferred package manager.
✅ Astro 4–7 Compatible
astro-intl 2.2.2 officially supports Astro 7 while retaining Astro 4–6 compatibility. Astro 7 requires Node.js 22.12.0 or newer; no new astro-intl API or migration is required.
Quick install
The Astro wizard installs the package and adds the integration to astro.config.mjs after your confirmation.
npx astro add astro-intlpnpm astro add astro-intlyarn astro add astro-intlAlternative: manual installation
Use this option if you prefer to edit the configuration manually. Install the package with your manager and then add the integration; you do not need to run both options.
npm install astro-intlpnpm add astro-intlyarn add astro-intlComplete the integration created by the wizard with both JSON files from Quick start, without duplicating it. If you chose manual installation, add the integration. Keep your project’s other integrations.
astro.config.mjs
import { defineConfig } from "astro/config";
import astroIntl from "astro-intl";
import en from "./src/i18n/messages/en.json" with { type: "json" };
import es from "./src/i18n/messages/es.json" with { type: "json" };
export default defineConfig({
integrations: [
astroIntl({
defaultLocale: "en",
locales: ["en", "es"],
messages: { en, es },
}),
],
});Installing the integration does not create messages or pages. Follow Quick start to complete those steps.