Skip to content

Commit 8b23153

Browse files
committed
Test sphinx-exercise i18n support from PR #75
- Update environment files to install sphinx-exercise from TeachBooks/sphinx-exercise@main - Change language to 'es' (Spanish) to test i18n functionality - Add testing documentation with setup and verification instructions
1 parent bbe71da commit 8b23153

File tree

4 files changed

+79
-3
lines changed

4 files changed

+79
-3
lines changed

TESTING_SPHINX_EXERCISE_I18N.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Testing sphinx-exercise Internationalization Support
2+
3+
This branch (`tst-sphinx-exercise`) is configured to test the internationalization (i18n) support for sphinx-exercise from PR #75.
4+
5+
## Changes Made
6+
7+
The environment files have been updated to install sphinx-exercise directly from the TeachBooks fork that includes i18n support:
8+
9+
- **environment.yml**: Updated to use `git+https://github.com/TeachBooks/sphinx-exercise.git@main`
10+
- **environment-cn.yml**: Updated to use `git+https://github.com/TeachBooks/sphinx-exercise.git@main`
11+
12+
## Setup Instructions
13+
14+
1. **Recreate the conda environment** to install the development version:
15+
```bash
16+
conda env remove -n quantecon
17+
conda env create -f environment.yml
18+
# Or for China mirror:
19+
# conda env create -f environment-cn.yml
20+
```
21+
22+
2. **Activate the environment**:
23+
```bash
24+
conda activate quantecon
25+
```
26+
27+
3. **Verify the installation**:
28+
```bash
29+
python -c "import sphinx_exercise; print(sphinx_exercise.__version__)"
30+
```
31+
32+
## Testing i18n Support
33+
34+
The configuration in `lectures/_config.yml` already includes:
35+
- `language: zh_CN` - This sets the Sphinx language to Chinese
36+
- `sphinx_exercise` extension is loaded
37+
38+
With the PR #75 changes, exercise and solution labels should now automatically translate to Chinese when building the documentation.
39+
40+
### Build the documentation
41+
42+
```bash
43+
cd lectures
44+
jupyter-book build .
45+
```
46+
47+
### What to Check
48+
49+
Look for translated labels in the built HTML:
50+
- **Exercise** should appear as the Chinese equivalent (练习)
51+
- **Solution to** should appear as the Chinese equivalent (解答)
52+
53+
You can inspect the HTML output in `lectures/_build/html/` or check specific lecture files that contain exercises.
54+
55+
## PR Reference
56+
57+
- **Pull Request**: https://github.com/executablebooks/sphinx-exercise/pull/75
58+
- **Issue**: https://github.com/executablebooks/sphinx-exercise/issues/73
59+
- **Branch**: TeachBooks:main
60+
61+
## Features Added by PR #75
62+
63+
1. Translation infrastructure using Sphinx's i18n system
64+
2. Support for multiple languages including Chinese (zh_CN)
65+
3. Automatic translation of "Exercise" and "Solution to" labels
66+
4. Translation files in `.po` format for various languages
67+
68+
## Reverting Changes
69+
70+
To revert back to the stable version:
71+
72+
```bash
73+
git checkout main
74+
conda env remove -n quantecon
75+
conda env create -f environment.yml
76+
```

environment-cn.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies:
1212
- sphinx-tojupyter==0.3.1
1313
- sphinxext-rediraffe==0.2.7
1414
- sphinx_reredirects==0.1.4
15-
- sphinx-exercise==1.0.1
15+
- git+https://github.com/TeachBooks/sphinx-exercise.git@main
1616
- sphinx-proof==0.3.0
1717
- ghp-import==1.1.0
1818
- sphinxcontrib-youtube==1.4.1 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- quantecon-book-theme==0.9.2
1111
- sphinx-tojupyter==0.3.1
1212
- sphinxext-rediraffe==0.2.7
13-
- sphinx-exercise==1.0.1
13+
- git+https://github.com/TeachBooks/sphinx-exercise.git@main
1414
- sphinx-proof==0.3.0
1515
- sphinxcontrib-youtube==1.4.1
1616
- sphinx-togglebutton==0.3.2

lectures/_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ latex:
3434
sphinx:
3535
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter, sphinxcontrib.youtube, sphinx.ext.todo, sphinx_exercise, sphinx_proof, sphinx_togglebutton, sphinx.ext.intersphinx, sphinx_reredirects]
3636
config:
37-
language: zh_CN
37+
language: es
3838
# false-positive links
3939
linkcheck_ignore: ['https://online.stat.psu.edu/stat415/book/export/html/834']
4040
bibtex_reference_style: author_year

0 commit comments

Comments
 (0)