Skip to content

Astro

Importimport { adapter } from "@wuchale/astro"
Loader extensions.js, .ts
Default filessrc/**/*.{astro} except **/*.d.ts
Available loadersdefault
CompatibilityTested with Astro >= 5

The Astro adapter implements support for Astro files.

This is assuming that you didn’t modify the default loader file, and that you have moved the contents of src/pages to src/[locales]/pages.

Since Astro is an SSR/SSG framework, there is only one simple way to load the locales.

src/middleware.js
import * as main from './locales/main.loader.js'
import { runWithLocale, loadLocales } from 'wuchale/load-utils/server';
import { locales } from './locales/data.js'
// load at server startup
loadLocales(main.key, main.loadIDs, main.loadCatalog, locales)
export function onRequest (context, next) {
const locale = context.params.locale ?? 'en'
return runWithLocale(locale, next);
};

This adapter only uses the default rules and has no additional restrictions.

For the main configuration, look in the configuration reference.

For the common adapter configuration, look in the common adapter options.