Skip to content

Enable the language switcher for the French edition - #21

Merged
mmcky merged 1 commit into
mainfrom
add-language-switcher
Aug 3, 2026
Merged

Enable the language switcher for the French edition#21
mmcky merged 1 commit into
mainfrom
add-language-switcher

Conversation

@mmcky

@mmcky mmcky commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Changes

Adds the language switcher configuration to html_theme_options in lectures/_config.yml, mirroring QuantEcon/lecture-python-programming#490 which adds the same block to the English source.

Code Name URL
en English https://python-programming.quantecon.org
fa فارسی https://quantecon.github.io/lecture-python-programming.fa
fr Français https://quantecon.github.io/lecture-python-programming.fr
zh-cn 中文 https://quantecon.github.io/lecture-python-programming.zh-cn

English stays first because the theme uses languages[0] as the hreflang x-default target.

Why this is a separate PR

The switcher does not propagate from the English source. The sync workflows trigger only on lectures/**/*.md and lectures/_toc.yml, so _config.yml never reaches a sync run — and sync carries lecture content, not site config. Each edition also needs its own current_language, so a verbatim copy would be wrong regardless. Hence one small PR per edition.

Verification

Built locally against the theme with this file's html_theme_options: the switcher lists all four languages with Français active, and the hreflang alternates inject including x-default → en.

No environment change needed — this repo already pins quantecon-book-theme==0.21.0, which provides the switcher.

This is the only one of the three translated editions whose html.baseurl and emitted canonical URL are already correct — https://quantecon.github.io/lecture-python-programming.fr/, matching where the site actually serves — so the hreflang half works here as intended. The .fa and .zh-cn PRs both carry a caveat on this point.

Mirrors QuantEcon/lecture-python-programming#490, which adds the same
block to the English source. Lists all four editions with
current_language set to fr so this edition renders as active, and
injects the hreflang alternates for the set.

English stays first in the list because the theme uses languages[0] as
the hreflang x-default target.

Verified with a local build against the theme: the switcher lists all
four languages with fr active.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings August 3, 2026 01:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables the QuantEcon book theme language switcher for the French edition by adding the languages list and current_language configuration under sphinx.config.html_theme_options in lectures/_config.yml, aligning the French site with the upstream pattern described in the PR metadata.

Changes:

  • Add html_theme_options.languages with entries for en, fa, fr, and zh-cn.
  • Set html_theme_options.current_language: fr so the French site is marked active in the switcher.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-21--verdant-toffee-3261a8.netlify.app

Commit: 7f0b861


Build Info

@mmcky
mmcky merged commit 2a0cb46 into main Aug 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants