wildcard/caro

feat(i18n): Add Language Switcher UI component (WP08)

Open

#466 opened on Jan 15, 2026

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Rust (6 forks)auto 404
enhancementgood first issuei18nperformance

Repository metrics

Stars
 (35 stars)
PR merge metrics
 (PR metrics pending)

Description

Context

Part of the i18n feature implementation (branch: 004-add-internationalization-i18n).

Parent Work: Core i18n infrastructure complete in PR #383 + follow-up commits Priority: P3 (Nice to have for v1.2.0) Work Package: WP08 Depends On: #465 (WP07) can be done independently

Goal

Language selection UI component with localStorage persistence, performance optimization, and SEO enhancements.

Acceptance Criteria

  • Language switcher appears in navigation with all 15 languages
  • Selecting a language persists across sessions
  • Page load time is within 100ms of English baseline
  • Sitemap includes hreflang for SEO

Subtasks

  • T035: Create website/src/components/LanguageSwitcher.astro with dropdown of all 15 languages
  • T036: Add client-side localStorage persistence logic
  • T037: Performance optimization - verify lazy loading of translations
  • T038: Add hreflang sitemap to public/sitemap.xml for SEO

Implementation Notes

  1. LanguageSwitcher component:

    • Display native language names (e.g., "Español", "日本語", "עברית")
    • Current language highlighted/selected
    • On change: redirect to corresponding locale URL
    • Use client-side script tag for interactivity
  2. localStorage persistence:

    • Save as caroPreferredLanguage
    • On page load, check and redirect if different
    • Respect manual URL navigation
  3. Performance:

    • Verify Astro's code splitting works
    • Measure with Lighthouse for baseline comparison
  4. SEO:

    • Generate sitemap with all locale URLs
    • Include hreflang entries for each language version

Files to Create/Modify

  • website/src/components/LanguageSwitcher.astro (new)
  • website/src/components/Navigation.astro (add LanguageSwitcher)
  • public/sitemap.xml or Astro sitemap config

Languages (15 total)

Code Native Name Direction
en English LTR
es Español LTR
fr Français LTR
pt Português LTR
de Deutsch LTR
ja 日本語 LTR
ko 한국어 LTR
ru Русский LTR
uk Українська LTR
he עברית RTL
ar العربية RTL
ur اردو RTL
hi हिन्दी LTR
fil Filipino LTR
id Bahasa Indonesia LTR

Deferred from i18n feature implementation. See kitty-specs/004-add-internationalization-i18n/tasks.md for full context.

Contributor guide