Languages
Astro i18n, locale folders, the language switcher, hreflang tags and AI translation.
Gitupcms follows Astro’s i18n config. Configure site → Languages edits it.
Turning languages on
- Enable on a collection moves its entries into
<base>/<defaultLocale>/in the same commit. The pattern becomes**/…so Astro still loads them (entry ids change). - In a repo without
i18n, Gitupcms finds Astro’s locale folders (src/pages/de/,src/content/blog/de/) and offers them as the locales. A default locale with no folder is guessed asen.
Language kit
Languages → Add a language switcher and hreflang tags copies two components into src/components/i18n/:
---
import { Hreflang, LanguageSwitcher } from "../components/i18n";
---
<html lang={Astro.currentLocale}>
<head>
<Hreflang />
</head>
<body>
<LanguageSwitcher />
<slot />
</body>
</html>
The install adds <Hreflang /> before </head> in layouts that do not already write hreflang, makes <html lang> follow Astro.currentLocale, and replaces a {/* gitupcms:language-switcher */}…{/* /gitupcms:language-switcher */} placeholder with the switcher.
- Both are built on
astro:config/client(Astro 5.7+), so they follow your Languages settings. - Hreflang lists only languages whose page file exists, with a self-reference, return tags and
x-default. It needssite. - Other locales get Astro’s
fallbackto the default locale, so switcher links never 404.
Templates
A template whose astro.config lists i18n.locales offers only those languages when you create a site. The new site keeps the ones you pick: the other src/content/<collection>/<locale>/ folders and <locale>.json files are deleted and i18n is rewritten.
AI translation
When you save a change in the AI Editor or Pages, you can translate it to the other languages.