Historial

Qué hay de nuevo en astro-intl

Un registro detallado de cada feature, fix y cambio importante en todas las versiones.

2.2.0

latest
Agregado

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].

Agregado

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.

Agregado

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).

Agregado

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.

Agregado

MessagesDirConfig type — exported type for the messagesDir configuration option.

Cambiado

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

Cambiado

Improved error messages when request config is not found.

2.1.0

initial
Agregado

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

Agregado

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.

Agregado

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

Agregado

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.

Cambiado

devDependencies.astro updated to ^6.1.0.

Cambiado

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

Cambiado

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

Seguridad

Resolved all 32 Dependabot vulnerability alerts, including:

2.0.0

initial
Seguridad

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

Seguridad

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

Seguridad

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

Agregado

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

Agregado

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

Agregado

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

Agregado

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

Agregado

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

Agregado

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

Agregado

svelte@^5 added as optional peer dependency.

Cambiado

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

Cambiado

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

Cambiado

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

1.1.0

initial
Agregado

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

Agregado

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

Agregado

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

Agregado

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

Agregado

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

Agregado

RoutesMap type exported from astro-intl/types.

Agregado

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

Agregado

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

Cambiado

createIntlMiddleware signature now accepts routes?: RoutesMap in options.

Cambiado

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

1.0.3

initial
Cambiado

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.

Agregado

defaultLocale option in IntlMiddlewareOptions type.

1.0.2

initial
Agregado

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

Agregado

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

Agregado

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

Agregado

IntlConfig type exported for integration configuration.

Cambiado

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

Cambiado

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

Corregido

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

Corregido

Hardcoded "en" fallback locale now respects defaultLocale config.

1.0.1

initial
Agregado

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

Agregado

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

Agregado

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

Agregado

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

Agregado

Messages via integration options (messages config).

Agregado

BCP-47 locale validation.

Agregado

Prototype-pollution protection in dot-path traversal.

Agregado

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

1.0.0

initial
Agregado

Initial release.

Agregado

setRequestLocale() for URL-based locale detection.

Agregado

getLocale() to read current locale.

Agregado

getTranslations() with namespace support.

Agregado

getTranslationsReact() for React components.

Agregado

Type-safety with DotPaths.

Agregado

Native Astro integration.