Polyglot wraps template and frontmatter strings, generates a typed translation util, and render-verifies the result — prerendered HTML with no leaked syntax.
Astro has no single dominant i18n library, so Polyglot generates a small typed utility (src/i18n/utils) and wraps your templates against it — the whole system arrives together and is verified together.
---
const title = "internal";
---
<html>
<body>
<h1>Welcome back</h1>
<p>Your projects are ready</p>
</body>
</html>---
import { getLangFromUrl, useTranslations } from "../i18n/utils";
const lang = getLangFromUrl(Astro.url);
const t = useTranslations(lang);
const title = "internal";
---
<html>
<body>
<h1>{t('src.pages.index.welcome_back')}</h1>
<p>{t('src.pages.index.your_projects_are_ready')}</p>
</body>
</html>Both template markup and frontmatter strings are handled; the generated useTranslations util resolves keys against the JSON catalogs translate maintains.
{
"src.pages.index.welcome_back": "Welcome back",
"src.pages.index.your_projects_are_ready": "Your projects are ready"
}{
"src": {
"pages": {
"index": {
"welcome_back": "Willkommen zurück",
"your_projects_are_ready": "Ihre Projekte sind bereit"
}
}
}
}{
"src": {
"pages": {
"index": {
"welcome_back": "Bon retour",
"your_projects_are_ready": "Vos projets sont prêts"
}
}
}
}Because Astro prerenders, this combination is covered by Polyglot's end-to-end matrix as a render-checked framework: real repos are cloned, wrapped, built, and their emitted HTML checked for content with zero leaked i18n syntax.
$ curl -fsSL https://getpolyglot.ai/install.sh | sh
$ polyglot init --framework astro
$ polyglot scan
$ polyglot wrap
$ polyglot translate --languages de # 50 strings free, no signupIm Terminal starten
Installieren Sie die CLI, führen Sie einen Scan durch und sehen Sie genau, was Ihnen fehlt. Kostenlos, kein Konto erforderlich.