Astro
| Import | import { adapter } from "@wuchale/astro" |
|---|---|
| Loader extensions | .js, .ts |
Default files | src/**/*.{astro} except **/*.d.ts |
| Available loaders | default |
| Compatibility | Tested with Astro >= 5 |
The Astro adapter implements support for Astro files.
Setup in Your App
Section titled “Setup in Your App”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.
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 startuploadLocales(main.key, main.loadIDs, main.loadCatalog, locales)
export function onRequest (context, next) { const locale = context.params.locale ?? 'en' return runWithLocale(locale, next);};Default extraction rules
Section titled “Default extraction rules”This adapter only uses the default rules and has no additional restrictions.
Configuration Reference
Section titled “Configuration Reference”For the main configuration, look in the configuration reference.
For the common adapter configuration, look in the common adapter options.