Add i18n support with English and Spanish locales#33
Merged
Conversation
…nual switch - Add Astro i18n config with /en/ and /es/ prefixed routes - Move pages under src/pages/[lang]/ generating both locales - Root / detects navigator.language + remembered cookie, redirects accordingly - Add LangToggle in header that swaps locale on the current path and persists the choice - Translate UI strings (nav, home, projects, posts, tags, 404, RSS) via src/i18n - Make post schema lang-aware (default en) and tag existing Spanish drafts as lang: es - Localize project data, dates and OG metadata; emit hreflang alternates + per-locale RSS https://claude.ai/code/session_01BmNYbBgWnGBDQ134Cs97S2
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of changes does this PR include?
Description
This PR adds comprehensive internationalization (i18n) support to the site, enabling English and Spanish language versions.
Key Changes:
src/i18n/config.tsandsrc/i18n/utils.tsto manage locales, translations, and path switchingsrc/i18n/ui.tswith complete English and Spanish translations for all UI strings (navigation, labels, page content, etc.)src/data/projects.tsto support bilingual project descriptions with a newLocalizedStringinterface andgetLocalizedProjects()functionlangfield and addedgetPostsByLocale()function to filter posts by language[lang]parameter routes (/en/,/es/) with locale-aware routingLangToggle.astrocomponent with dropdown menu for switching between languages, with cookie persistenceindex.astroto detect user's language preference (from cookie or browser) and redirect to appropriate localeRemoved:
/about.astro,/tags/index.astro,/posts/[...page].astro,/projects.astro,/rss.xml.ts)All content is now available in both English and Spanish with proper URL structure and language switching capabilities.
Test Plan
/en/and/es/routes works correctly/en/rss.xmland/es/rss.xmlhttps://claude.ai/code/session_01BmNYbBgWnGBDQ134Cs97S2