History

What's new in astro-intl

A detailed log of every feature, fix, and breaking change across all versions.

2.2.0

latest
Added

t.raw() function — access raw translation values (arrays, objects, numbers) without string coercion. Use t.raw("key") to get the native value type instead of [object Object].

Added

messagesDir integration option — simplified API for loading JSON files. Set messagesDir: "./src/i18n/messages" and the integration will automatically load {locale}.json files with the correct import attributes.

Added

Auto-detection of locale in static modegetLocale() now automatically detects the locale from window.location.pathname when setRequestLocale() hasn't been called (client-side only).

Added

component — new Astro component export from astro-intl/components. Detects browser language and redirects to the appropriate localized route without the blank page issue of Astro.redirect(). Supports locales and defaultLocale props.

Added

MessagesDirConfig type — exported type for the messagesDir configuration option.

Changed

Updated package.json exports to include ./components sub-path for the AutoRedirect component.

Changed

Improved error messages when request config is not found.

2.1.0

initial
Added

Astro v6 supportpeerDependencies now accepts ^4 || ^5 || ^6. Backward compatible with Astro 4 and 5.

Added

getFallbackRoutes() API — new public function that returns i18n fallback routes collected from Astro 6.1's astro:routes:resolved hook. Returns an empty array on Astro < 6.1.

Added

FallbackRouteInfo type — exported type with { pattern: string; pathname?: string; locale: string }.

Added

astro:routes:resolved hook — the integration now listens to this hook to automatically detect and store fallback routes when i18n.fallbackType: 'rewrite' is configured in Astro.

Changed

devDependencies.astro updated to ^6.1.0.

Changed

@astrojs/vercel updated to ^10.0.3 in docs projects (Astro 6 compatible).

Changed

happy-dom updated to ^20.8.9 to fix CVE-2026-33943 (RCE via ECMAScriptModuleCompiler).

Security

Resolved all 32 Dependabot vulnerability alerts, including:

2.0.0

initial
Security

getTranslationsReact removed from root export — React support is now imported from astro-intl/react instead of astro-intl.

Security

Sub-path imports required for framework adapters — use astro-intl/react and astro-intl/svelte instead of importing from the root.

Security

Old src/react.ts deleted — logic migrated to src/adapters/react.ts.

Added

Svelte adaptergetTranslations and createGetTranslations with t.rich() returning RichSegment[]. Import from astro-intl/svelte.

Added

renderRichText() helper — resolves RichSegment[] into an HTML string using tags (native HTML elements) and components (custom functions). Import from astro-intl/svelte.

Added

RichSegment type — framework-agnostic segment type (text | tag) exported from astro-intl/svelte.

Added

createGetTranslations factory — standalone translation factory (no store dependency) available in both React and Svelte adapters.

Added

Framework-agnostic baseparseRichSegments() in src/framework-base.ts powers both React and Svelte rich text parsing.

Added

New sub-path exportsastro-intl/react and astro-intl/svelte in package.json exports.

Added

svelte@^5 added as optional peer dependency.

Changed

React adapter moved from src/react.ts to src/adapters/react.ts.

Changed

React t.rich() now uses the shared parseRichSegments() base with recursive nested tag support.

Changed

Package structure reorganized with src/adapters/ directory for framework-specific code.

1.1.0

initial
Added

Localized routing system — define translated URL paths per locale (e.g. /es/sobre-nosotros instead of /es/about).

Added

path(routeKey, options?) — generate localized URLs for named routes with dynamic [param] substitution. Import from astro-intl/routing.

Added

switchLocalePath(currentPath, nextLocale) — convert the current URL to its equivalent in another locale, preserving params, query strings and hashes. Import from astro-intl/routing.

Added

routes option in createIntlMiddleware — the middleware automatically rewrites translated URLs to their canonical filesystem paths (no duplicate page files needed).

Added

routes option in integration config (astro.config.mjs) — for projects that don't use middleware.

Added

RoutesMap type exported from astro-intl/types.

Added

Route template validation — detects unbalanced brackets and invalid param names at build time.

Added

Route conflict detection — throws on duplicate templates and warns on structurally equivalent ones.

Changed

createIntlMiddleware signature now accepts routes?: RoutesMap in options.

Changed

New ./routing export path in package.json for astro-intl/routing.

1.0.3

initial
Changed

createIntlMiddleware() now automatically sets locales and defaultLocale in the intl store via __setIntlConfig. Users who use middleware no longer need to pass these options to intl() in astro.config.mjs.

Added

defaultLocale option in IntlMiddlewareOptions type.

1.0.2

initial
Added

Configurable defaultLocale option — no more hardcoded "en" fallback.

Added

runWithLocale() — concurrency-safe request context via AsyncLocalStorage.

Added

Multi-runtime support — auto-detects AsyncLocalStorage (Node.js) with global-variable fallback (Cloudflare Workers, Deno).

Added

IntlConfig type exported for integration configuration.

Changed

Modular architecture — core.ts split into sanitize, interpolation, store, translations modules.

Changed

react.ts now imports shared escapeRegExp from sanitize.ts (removed duplicate).

Fixed

Race condition in SSR — concurrent requests no longer share state.

Fixed

Hardcoded "en" fallback locale now respects defaultLocale config.

1.0.1

initial
Added

Variable interpolation with t("key", { name: "value" }).

Added

t.markup() for HTML in translations with security sanitisation.

Added

t.rich() for React with nested tag support.

Added

defineRequestConfig() for global config registration (next-intl style).

Added

Messages via integration options (messages config).

Added

BCP-47 locale validation.

Added

Prototype-pollution protection in dot-path traversal.

Added

HTML sanitisation (defence-in-depth) in t.markup().

1.0.0

initial
Added

Initial release.

Added

setRequestLocale() for URL-based locale detection.

Added

getLocale() to read current locale.

Added

getTranslations() with namespace support.

Added

getTranslationsReact() for React components.

Added

Type-safety with DotPaths.

Added

Native Astro integration.