You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add language switcher for multilingual site support (#374)
* feat: add language switcher for multilingual site support
Add a hosting-agnostic language switcher to the theme toolbar that allows
users to switch between translated versions of lecture sites.
Theme changes:
- New theme options: languages (list) and current_language (string)
- Globe icon dropdown at far right of toolbar (after GitHub icon)
- hreflang link tags in head for SEO
- Dark theme and RTL-aware styling
- Keyboard accessible (Escape to close, click-outside-to-close)
- Only renders when 2+ languages configured (backwards compatible)
Documentation:
- Updated docs/developer/multilingual.md with implementation docs
- New docs/developer/infrastructure.md for hosting guidance
- Updated PLAN_MULTILINGUAL_SUPPORT.md (theme-focused)
- New PLAN-INFRASTRUCTURE.md (hosting/DNS concerns)
Files added:
- src/quantecon_book_theme/assets/scripts/language-switcher.js
- src/quantecon_book_theme/assets/styles/_language-switcher.scss
- docs/developer/infrastructure.md
- PLAN-INFRASTRUCTURE.md
* chore: remove completed PLAN documents
All content has been implemented in code and documented in
docs/developer/multilingual.md and docs/developer/infrastructure.md.
* fix: address Copilot review feedback and add test coverage
- Validate language entries (require code, name, url fields)
- Normalize URLs by stripping trailing slashes
- Extract _process_languages() for testability
- Fix ARIA roles: role=menuitem on <a>, role=none on <li>
- Fix theme.conf defaults: languages = [] for type consistency
- Fix broken reference to deleted PLAN-INFRASTRUCTURE.md
- Add 10 unit tests for language processing (test_language_switcher.py)
* fix: remove unused pytest import (flake8 F401)
* Rename lecture-python-programming.myst to lecture-python-programming
Update all references to the renamed repository across CI workflows,
tox configuration, Playwright config, documentation, and .gitignore.
* UPDATE: Regenerate all visual snapshots (1 files)
* Increase toolbar visual test tolerance to 0.03
The toolbar screenshot on mobile has minor pixel-level rendering
variability with the language switcher, causing flaky failures at
the default 0.01 threshold.
* Fix language switcher dropdown opening off-screen
The dropdown was positioned above the toolbar (bottom: 100%) which
caused it to open off-screen since the toolbar is at the top of the
page. Changed to open below (top: 100%) with arrow pointing up and
right-aligned to stay within the viewport.
* Remove dir=rtl from language switcher menu items
Language names in the dropdown should be consistently left-aligned
regardless of the target language's text direction. The dir attribute
is for content blocks, not navigation labels.
* Add language switcher and repo rename to CHANGELOG
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Added
11
+
-**Language switcher for multilingual site support** (#374) — a globe icon dropdown in the bottom toolbar that enables users to switch between translated versions of a lecture site. Only renders when 2+ languages are configured via `html_theme_options`. Includes keyboard navigation, click-outside-to-close, and dark mode support.
12
+
-**SEO hreflang tags** (#374) — automatically injects `<link rel="alternate" hreflang="...">` meta tags in `<head>` for all configured languages, improving search engine discovery of translated content.
13
+
-**Multilingual infrastructure documentation** (#374) — new developer guide at `docs/developer/infrastructure.md` covering three hosting options (GitHub Pages, subdomains, reverse proxy) for deploying translated lecture sites.
14
+
15
+
### Changed
16
+
-**Renamed `lecture-python-programming.myst` to `lecture-python-programming`** (#374) — updated all CI workflows, tox config, Playwright config, and documentation to reflect the renamed test repository.
0 commit comments