Add i18n support with Spanish and English locales#26
Merged
Conversation
- Split cv.json into cv.es.json and cv.en.json with full translations - Configure Astro i18n routing (/ = es, /en/ = en) - Add i18n utility module with UI translation strings and locale helpers - Update cv.ts loader with getCv(locale) for locale-aware data loading - Add automatic language detection via navigator.language on first visit - Add subtle language switcher (ES/EN) in sidebar and mobile header - Update all components with locale-aware section titles, nav labels, and aria-labels - Add hreflang tags (es, en, x-default) and locale-specific og:locale - Localize structured data (JSON-LD) per language - Update tests to validate both locale data files https://claude.ai/code/session_01Nhp3Z1188ksAqD4FnZ6ff6
- Wrap localStorage calls in try-catch for private browsing compatibility
- Translate Navigation aria-label ("Navegación principal" / "Main navigation")
- Localize knowsAbout in JSON-LD structured data per locale
- Add sitemap i18n config for xhtml:link hreflang alternates in XML
- Extract shared HomePage.astro to deduplicate page templates
- Use canonicalURL consistently for og:url and twitter:url
- Add structural parity test between locale JSON files
https://claude.ai/code/session_01Nhp3Z1188ksAqD4FnZ6ff6
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.
Summary
This PR adds full internationalization (i18n) support to the portfolio, enabling Spanish and English language versions with locale-specific CV data, UI strings, and routing.
Key Changes
Locale System: Implemented i18n infrastructure with Spanish (es) as default and English (en) as secondary locale
src/i18n/index.tswith translation strings for navigation, SEO, ARIA labels, and structured datagetLocale()helper to detect and manage locale from Astro'scurrentLocaleMulti-locale CV Data:
public/cv.es.jsonwith Spanish CV content (Sergio's full professional profile)src/data/cv.tsto support dynamic locale loading viagetCv(locale)functionRouting & Navigation:
/for Spanish,/en/for Englishsrc/pages/en/index.astrofor English routesrc/pages/index.astroto use locale-aware CV dataLanguageSwitchercomponent for easy locale switchingLocale Detection & Persistence:
/en/on first visitSEO & Metadata:
BaseHead.astrowith hreflang alternate links for both localesknowsAboutarrayComponent Updates:
Testing:
src/data/__tests__/cv.test.tswith comprehensive locale validationImplementation Details
Astro.currentLocalefrom the i18n routing configurationsrc/i18n/index.tsfor easy maintenancecvexport for tests and legacy codehttps://claude.ai/code/session_01Nhp3Z1188ksAqD4FnZ6ff6