Skip to content

Add language switcher support for fa and zh-cn repositories#490

Open
mmcky wants to merge 1 commit into
mainfrom
add-language-switcher-fa-zh-cn
Open

Add language switcher support for fa and zh-cn repositories#490
mmcky wants to merge 1 commit into
mainfrom
add-language-switcher-fa-zh-cn

Conversation

@mmcky

@mmcky mmcky commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Changes

Add the language switcher configuration to html_theme_options in lectures/_config.yml:

  • English (en) — https://python-programming.quantecon.org
  • فارسی (fa) — https://quantecon.github.io/lecture-python-programming.fa
  • 中文 (zh-cn) — https://quantecon.github.io/lecture-python-programming.zh-cn
  • current_language: en

This enables the language switcher globe icon in the bottom toolbar and injects SEO hreflang tags for all configured languages.

No environment.yml change is needed: main already ships quantecon-book-theme==0.21.0 (bumped in #558), which provides the switcher. This branch was rebased onto current main so it is now a single-file _config.yml change.

Verified against quantecon-book-theme==0.21.0 with a local build: the switcher renders all three languages (English active) and the hreflang alternates — including x-default → en — inject correctly into <head>.

Ref: https://github.com/QuantEcon/quantecon-book-theme/releases/tag/v0.20.0

@mmcky mmcky added the testing label Mar 23, 2026
@github-actions

github-actions Bot commented Mar 23, 2026

Copy link
Copy Markdown

@github-actions github-actions Bot temporarily deployed to pull request March 23, 2026 04:25 Inactive
@github-actions github-actions Bot temporarily deployed to pull request March 25, 2026 03:59 Inactive
Add `languages` and `current_language` to `html_theme_options` to enable
the language switcher (globe icon) and SEO hreflang tags provided by
quantecon-book-theme. Main already ships the 0.21.0 theme, so no
environment change is needed here.

Languages:
- English (en) — https://python-programming.quantecon.org
- فارسی (fa) — https://quantecon.github.io/lecture-python-programming.fa
- 中文 (zh-cn) — https://quantecon.github.io/lecture-python-programming.zh-cn

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 17, 2026 02:05
@mmcky mmcky force-pushed the add-language-switcher-fa-zh-cn branch from 4c4ed45 to 4d35290 Compare June 17, 2026 02:05
@mmcky mmcky changed the title [TEST] Add language switcher support for fa and zh-cn repositories Add language switcher support for fa and zh-cn repositories Jun 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds multi-language switcher configuration to the Jupyter Book theme settings so the site can link between the English, Farsi, and Simplified Chinese builds (and emit corresponding hreflang alternates).

Changes:

  • Adds languages entries (en, fa, zh-cn) under sphinx.config.html_theme_options.
  • Sets current_language: en to mark the English build as active.

Comment thread lectures/_config.yml
Comment thread lectures/_config.yml
Comment thread lectures/_config.yml
@github-actions github-actions Bot temporarily deployed to pull request June 17, 2026 03:28 Inactive
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