Skip to content

Commit 551b87e

Browse files
Yikunaidoczh
andauthored
[v0.9.1] Add CN docs (#2657)
### What this PR does / why we need it? Add CN docs - backport #1870 - Add `make po` TODO: - Translation new doc ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? ``` cd docs python -m venv ./.venv source .venv # Install dependencies. pip install -r requirements-docs.txt # Build the docs. make clean make html # Extract po files make po # Do translations # Build the docs with translation make intl # Open the docs with your browser python -m http.server -d _build/html/ ``` http://localhost:8000/ http://localhost:8000/zh-cn --------- Signed-off-by: aidoczh <[email protected]> Signed-off-by: Yikun Jiang <[email protected]> Co-authored-by: aidoczh <[email protected]>
1 parent a3970e8 commit 551b87e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+11363
-7
lines changed

docs/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ help:
1919
%: Makefile
2020
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
2121

22+
po:
23+
make gettext
24+
sphinx-intl update -p _build/gettext -l zh_CN
25+
26+
intl:
27+
sphinx-intl build
28+
@$(SPHINXBUILD) -b html -D language=zh_CN "$(SOURCEDIR)" "$(BUILDDIR)/html/zh-cn" $(SPHINXOPTS) $(O)
29+

docs/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,19 @@ pip install -r requirements-docs.txt
1111
# Build the docs.
1212
make clean
1313
make html
14-
```
1514

16-
## Open the docs with your browser
15+
# Extract po files
16+
make po
1717

18-
```bash
18+
# Do translations
19+
20+
# Build the docs with translation
21+
make intl
22+
23+
# Open the docs with your browser
1924
python -m http.server -d _build/html/
2025
```
2126

22-
Launch your browser and open http://localhost:8000/.
23-
27+
Launch your browser and open:
28+
- English version: http://localhost:8000
29+
- Chinese version: http://localhost:8000/zh_CN

docs/requirements-docs.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ sphinx-togglebutton
77
myst-parser
88
msgspec
99
sphinx-substitution-extensions
10+
sphinx-intl

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
#
8787
# This is also used if you do content translation via gettext catalogs.
8888
# Usually you set "language" from the command line for these cases.
89-
language = 'en'
90-
89+
locale_dirs = ['locale/']
90+
gettext_compact = False
9191
# List of patterns, relative to source directory, that match files and
9292
# directories to ignore when looking for source files.
9393
# This pattern also affects html_static_path and html_extra_path.

0 commit comments

Comments
 (0)