Help us improve
Share bugs, ideas, or general feedback.
From astro
ACTIVATE when implementing multilingual Astro sites, language switching, translated routes, or translation patterns. ACTIVATE for 'i18n', 'multilingual', 'language switch', 'hreflang', 'translate route', 'getLang'. Covers: prefix-based routing (fr default, /en prefix), route mapping between languages, translation dictionary without external library, multilingual content collections, hreflang SEO tags, language switcher component. DO NOT use for: Astro routing basics (see astro-routing), SEO tags (see astro-seo).
npx claudepluginhub fabiensalles/claude-marketplace --plugin astroHow this skill is triggered — by the user, by Claude, or both
Slash command
/astro:astro-i18nThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Patterns for building multilingual Astro sites without external libraries.
Use when implementing internationalization in Astro, configuring i18n routing, setting up locale strategies, using getRelativeLocaleUrl/getAbsoluteLocaleUrl, handling Astro.currentLocale, or adding hreflang tags with sitemap.
Comprehensive best practices, routing patterns, component architecture, and static site generation techniques for building high-performance Astro websites.
Next.js 16 internationalization with next-intl or DIY. Use when implementing i18n, translations, localization, multilingual, language switch, locale routing, or formatters.
Share bugs, ideas, or general feedback.
Patterns for building multilingual Astro sites without external libraries.
src/pages/
├── index.astro # / (French default)
├── about.astro # /about
├── blog/
│ └── [...slug].astro # /blog/*
└── en/
├── index.astro # /en
├── about.astro # /en/about
└── blog/
└── [...slug].astro # /en/blog/*
// src/utils/i18n.ts
export function getLang(pathname: string): 'fr' | 'en' {
return pathname.startsWith('/en') ? 'en' : 'fr';
}
export function getLocalizedPath(path: string, lang: 'fr' | 'en'): string {
const cleanPath = path.replace(/^\/en/, '');
return lang === 'en' ? `/en${cleanPath}` : cleanPath;
}
When implementing route mapping between languages (static or dynamic), read
references/i18n-implementation-patterns.mdfor complete mapping implementations.
When setting up a translations dictionary with JSON files and helper functions, read
references/i18n-implementation-patterns.mdfor the full dictionary setup and useTranslations pattern.
When organizing multilingual content collections (separate collections, prefixed slugs, or frontmatter-based), read
references/i18n-implementation-patterns.mdfor all three approaches.
When building a language switcher component or multilingual navigation, read
references/i18n-implementation-patterns.mdfor complete LanguageSwitcher.astro and nav patterns.
| French | English | Pattern |
|---|---|---|
/ | /en | Homepage |
/blog | /en/blog | Section |
/blog/mon-slug | /en/blog/my-slug | Content |
/formations | /en/training | Translated route |
| Function | Purpose |
|---|---|
getLang(path) | Extract language from URL |
t(key, lang) | Get translation |
translateRoute(path, lang) | Convert path to other language |
getLocalizedPath(path, lang) | Add/remove language prefix |
| Tag | Purpose |
|---|---|
<html lang=""> | Document language |
hreflang links | Language alternates |
og:locale | Social sharing language |
x-default | Default/fallback version |