/astro:astro-i18nfrom astro
Implements multilingual Astro sites with prefix-based routing, route mapping between languages, translation dictionaries, content collections, hreflang SEO, and a language switcher component. No external libraries needed.
Ships in astro. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
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.
When wiring hreflang tags into
<head>, read the "SEO for Multilingual Sites" section ofreferences/i18n-implementation-patterns.mdfor the full alternate-language markup.
| 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 |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub fabiensalles/claude-marketplace --plugin astro11 skills in this plugin
/astro-basicsACTIVATE when creating Astro components, layouts, pages, or setting up Astro project structure. ACTIVATE for 'Astro component', 'slot', 'layout', 'Astro.props', 'class:list'. Covers: component anatomy (frontmatter/template/style/script), layout pattern with slot, props patterns, scoped vs global styles, script patterns (build-time vs client-side), path aliases. DO NOT use for: content collections (see astro-content-collections), routing (see astro-routing), React islands (see astro-react)./astro-content-collectionsACTIVATE when working with Astro content collections, markdown/MDX files, YAML frontmatter, Zod schemas for content, or content-driven pages. ACTIVATE for 'getCollection', 'getEntry', 'defineCollection', 'content collection', 'content.config.ts'. Covers: collection schema definition with Zod, loader-based collections, querying/filtering collections, dynamic routes with getStaticPaths, YAML meta files, MDX with components, collection references. DO NOT use for: routing logic (see astro-routing), general Astro components (see astro-basics)./astro-envACTIVATE when working with environment variables, feature flags, or runtime configuration in Astro. ACTIVATE for 'import.meta.env', '.env', 'PUBLIC_', 'feature flag'. Covers: server vs client variables (PUBLIC_ prefix), feature flags pattern with centralized config, TypeScript env declarations, build-time vs runtime variables, Netlify/Vercel deployment vars. DO NOT use for: general Astro setup, content configuration.