Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sphinx-intl to create Chinese versions and provide automated deployment to the gh-pages branch. #1109

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: deploy
on:
push:
branches:
- xin

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- uses: s-weigand/setup-conda@v1
- run: conda --version
- run: which python

- name: Install dependencies
run: |
pip install -r requirements.txt
pip install sphinx-intl

- name: Build the book
run: |
sphinx-build -b gettext docs build/gettext
sphinx-intl update -p build/gettext -l zh_CN
sphinx-build -D language=zh_CN -b html docs build/html

- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build/html
user_name: "github-actions[bot]"
user_email: "github-actions[bot]@users.noreply.github.com"
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None
language = 'zh_CN'

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
Expand Down Expand Up @@ -286,3 +286,6 @@
intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}

locale_dirs = ['../locales']
gettext_compact = False # optional.
1 change: 1 addition & 0 deletions locales/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.mo
52 changes: 52 additions & 0 deletions locales/zh_CN/LC_MESSAGES/404.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2011-2021 <a
# href="https://www.kennethreitz.org/projects">Kenneth Reitz</a> &amp; <a
# href="https://realpython.com">Real Python</a>. <a
# href="http://creativecommons.org/licenses/by-nc-sa/3.0/">CC BY-NC-SA
# 3.0</a>
# This file is distributed under the same license as the pythonguide
# package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: pythonguide 0.0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-11-18 16:06+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"

#: ../../docs/404.rst:5
msgid "404 — Not Found"
msgstr ""

#: ../../docs/404.rst:7
msgid "**Sorry, but we couldn't find the page you requested.**"
msgstr ""

#: ../../docs/404.rst:9
msgid "It looks like this was the result of either:"
msgstr ""

#: ../../docs/404.rst:11
msgid "a mistyped address"
msgstr ""

#: ../../docs/404.rst:12
msgid "an out-of-date link"
msgstr ""

#: ../../docs/404.rst:14
msgid "`Click here to go back to the homepage. <https://docs.python-guide.org/>`_"
msgstr ""

#: ../../docs/404.rst:16
msgid "Or, try `searching <https://docs.python-guide.org/search/>`_."
msgstr ""

Loading