Skip to content

Conversation

@hbeneke
Copy link

@hbeneke hbeneke commented Dec 4, 2025

What kind of changes does this PR include?

  • Changes with larger consequences (logic, library updates, etc.)

Description

This PR adds a complete internationalization (i18n) system to the theme without duplicating pages.

Key changes:

  • New i18n system (src/i18n/) with centralized translations for English (default) and Spanish
  • Language toggle dropdown in the header with a globe icon for easy language switching
  • Client-side language persistence using localStorage
  • Content filtering by language - Posts, notes, and tags pages now filter content based on the selected language
  • Schema updates - Added lang field to post and note content schemas
  • Flash prevention - CSS-based solution to prevent "flash of untranslated content" on page load
  • Example Spanish content - 3 posts and 1 note in Spanish for demonstration

** Breaking changes:**

  • Posts and notes now require a lang field (defaults to "en" if not specified)
  • The posts, notes, and tags listing pages will only show content matching the user's selected language
  • Users switching languages will see different content based on available translations

How it works:

  1. Language preference is stored in localStorage (key: lang)
  2. On page load, content is filtered client-side via data-lang attributes
  3. UI elements use data-i18n attributes for translation

solves #42

- Add i18n module with English and Spanish translations
- Implement client-side language switching via localStorage
- Add data-i18n attributes for dynamic text translation
- Add lang field to post and note content schemas
- Filter content by selected language on all pages
- Prevent flash of untranslated content with CSS
- Add globe icon for language selection
- Implement dropdown menu with available languages
- Highlight current language in menu
- Add lang: en to all existing English posts and notes
- Add Spanish welcome post (bienvenida.md)
- Add Spanish post about Astro framework
- Add Spanish post about developer productivity tools
- Add Spanish test note
@netlify
Copy link

netlify bot commented Dec 4, 2025

👷 Deploy request for astro-theme-cactus pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 093c7e3

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants