File structure

This is the entire structure needed for the initial example. Names in messages must match the imports in your configuration.

Required files

astro.config.mjs connects languages and messages. JSON files hold the text. The page generates both URLs and selects the language before translating.

Minimal structure
astro.config.mjs
src/
  i18n/messages/
    en.json
    es.json
  pages/[lang]/
    index.astro

Optional files as your project grows

layouts/Layout.astro shares HTML; components/ holds reusable pieces. i18n/request.ts is only needed when you choose a custom loader. middleware.ts centralizes initialization before rendering. i18n/routing.ts organizes translated routes. None is required for the quick start.