Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
751bb6fd
"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "2c779d0b574cde9055b980145504ee9fb0d0ed3a"
Unverified
Commit
751bb6fd
authored
Mar 28, 2022
by
Yuge Zhang
Committed by
GitHub
Mar 28, 2022
Browse files
Patch of translation for sphinx 4.5 (#4708)
parent
84d3746f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
41 deletions
+22
-41
dependencies/develop.txt
dependencies/develop.txt
+1
-1
docs/extension/patch_docutils.py
docs/extension/patch_docutils.py
+0
-39
docs/source/conf.py
docs/source/conf.py
+0
-1
docs/tools/translation_patch.py
docs/tools/translation_patch.py
+17
-0
pipelines/fast-test.yml
pipelines/fast-test.yml
+4
-0
No files found.
dependencies/develop.txt
View file @
751bb6fd
...
...
@@ -10,7 +10,7 @@ pytest
pytest-azurepipelines
pytest-cov
rstcheck
sphinx >= 4.
4
sphinx >= 4.
5
sphinx-argparse-nni >= 0.4.0
sphinx-gallery
sphinxcontrib-bibtex
...
...
docs/extension/patch_docutils.py
deleted
100644 → 0
View file @
84d3746f
"""Additional docutils patch to suppress warnings in i18n documentation build."""
from
typing
import
Any
import
docutils
from
docutils.utils
import
Reporter
class
Patch
:
"""
This is actually done in sphinx, but sphinx didn't replace all `get_language` occurrences.
https://github.com/sphinx-doc/sphinx/blob/680417a10df7e5c35c0ff65979bd22906b9a5f1e/sphinx/util/docutils.py#L127
Related issue:
https://github.com/sphinx-doc/sphinx/issues/10179
"""
original
=
None
def
restore
(
self
,
*
args
,
**
kwargs
):
assert
self
.
original
is
not
None
docutils
.
parsers
.
rst
.
languages
.
get_language
=
self
.
original
def
patch
(
self
,
*
args
,
**
kwargs
):
from
docutils.parsers.rst.languages
import
get_language
self
.
original
=
get_language
def
patched_get_language
(
language_code
:
str
,
reporter
:
Reporter
=
None
)
->
Any
:
return
get_language
(
language_code
)
docutils
.
parsers
.
rst
.
languages
.
get_language
=
patched_get_language
def
setup
(
app
):
# See life-cycle of sphinx app here:
# https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-core-events
patch
=
Patch
()
app
.
connect
(
'env-before-read-docs'
,
patch
.
patch
)
app
.
connect
(
'env-merge-info'
,
patch
.
restore
)
docs/source/conf.py
View file @
751bb6fd
...
...
@@ -62,7 +62,6 @@ extensions = [
'inplace_translation'
,
'cardlinkitem'
,
'codesnippetcard'
,
'patch_docutils'
,
'patch_autodoc'
,
]
...
...
docs/tools/translation_patch.py
0 → 100644
View file @
751bb6fd
"""
Fix a troublsome translation in sphinx.
Related PR: https://github.com/sphinx-doc/sphinx/pull/10303
"""
import
subprocess
from
pathlib
import
Path
import
sphinx
sphinx_path
=
Path
(
sphinx
.
__path__
[
0
])
/
'locale/zh_CN/LC_MESSAGES'
po_content
=
(
sphinx_path
/
'sphinx.po'
).
read_text
()
po_content
=
po_content
.
replace
(
'%s的别名'
,
'%s 的别名'
)
(
sphinx_path
/
'sphinx.po'
).
write_text
(
po_content
)
# build po -> mo
subprocess
.
run
([
'msgfmt'
,
'-c'
,
str
(
sphinx_path
/
'sphinx.po'
),
'-o'
,
str
(
sphinx_path
/
'sphinx.mo'
)],
check
=
True
)
pipelines/fast-test.yml
View file @
751bb6fd
...
...
@@ -29,7 +29,11 @@ stages:
displayName
:
Sphinx sanity check
-
script
:
|
set -e
cd docs
rm -rf build
sudo apt-get install -y gettext
python tools/translation_patch.py
make -e SPHINXOPTS="-W --keep-going -T -q -D language='zh'" html
displayName
:
Sphinx sanity check (Chinese)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment