Clean i18n in Astro
A pattern for managing bilingual content with Content Collections without logic duplication.
Published , astro, i18n, typescript
Managing two languages often ends up messy because strings are scattered everywhere. The fix: one central dictionary, pure locale helpers, and thin routes.
A Proven Structure
- All UI strings live in one dictionary file.
- Markdown content carries a
langfield. - Routes only forward the locale to components.
The result: adding a new language means adding one dictionary entry and a mirror route folder.