File Structure

astro-intl expects a specific folder structure inside your project. Here is the recommended layout:

Project structure
src/
├── i18n/
│   ├── messages/
│   │   ├── en.json       ← English translations
│   │   └── es.json       ← Spanish translations
│   └── request.ts        ← Locale resolver
├── layouts/
│   └── Layout.astro      ← Shared layout
├── pages/
│   └── [lang]/           ← Dynamic locale segment
│       ├── index.astro
│       └── docs.astro
└── components/
    └── MyComponent.astro
pages/[lang]/ Pages must be nested under a [lang] dynamic segment so Astro can generate one route per locale.
messages/ Each locale gets its own JSON file inside src/i18n/messages/. The filename must match the locale code exactly (e.g. en.json, es.json).
request.ts The request.ts file exports a function that receives the locale string and returns the messages for that locale.