← Back to Blog

Internationalization Made Easy

Astro 4+ includes built-in internationalization support, and Sveltia CMS makes it easy to manage content in multiple languages. This combination gives you a seamless multilingual experience.

The Multiple Folders Structure

We use the multiple_folders i18n structure, which organizes content like this:

src/content/posts/
├── en/
│   ├── getting-started.mdx
│   └── i18n-made-easy.mdx
├── es/
│   └── getting-started.mdx
└── ja/
    └── getting-started.mdx

Each locale has its own folder, and Sveltia CMS handles the translations through its built-in i18n support.

Configuring i18n in Sveltia CMS

In your astro.config.mjs, add the i18n configuration:

i18n: {
  structure: "multiple_folders",
  locales: ["en", "es", "ja"],
  default_locale: "en",
}

For each collection, mark fields as i18n: true for translatable content, or i18n: "duplicate" for shared fields like dates.

Astro i18n Routing

Astro’s built-in i18n routing handles URL prefixes automatically. Configure it in your astro.config.mjs:

i18n: {
  defaultLocale: "en",
  locales: ["en", "es", "ja"],
  routing: {
    prefixDefaultLocale: true,
  },
}

This creates clean URLs like /en/blog/, /es/blog/, and /ja/blog/.