Skip to content

Commit aa05597

Browse files
committed
Fixed docs navigation item being mistranslated
1 parent 58a6ee4 commit aa05597

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

_sphinx_13448_workaround/__init__.py

Whitespace-only changes.

_sphinx_13448_workaround/apps.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from django.apps import AppConfig
2+
from sphinx.locale import _TranslationProxy
3+
from sphinxcontrib.serializinghtml import jsonimpl
4+
5+
6+
class FixedSphinxJSONEncoder(jsonimpl.SphinxJSONEncoder):
7+
def default(self, obj):
8+
if isinstance(obj, _TranslationProxy):
9+
return str(obj)
10+
return super().default(obj)
11+
12+
13+
class SphinxBugWorkaroundConfig(AppConfig):
14+
"""
15+
Add a workaround for sphinx bug https://github.com/sphinx-doc/sphinx/issues/13448
16+
"""
17+
18+
name = "_sphinx_13448_workaround"
19+
verbose_name = "Sphinx Bug 13448 Workaround"
20+
21+
def ready(self):
22+
from sphinx.domains import python # noqa: F401
23+
24+
jsonimpl.SphinxJSONEncoder = FixedSphinxJSONEncoder

djangoproject/settings/common.py

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@
8989
"django.contrib.sitemaps",
9090
"django_push.subscriber",
9191
"django_read_only",
92+
# Temporary fix for Sphinx bug.https://github.com/sphinx-doc/sphinx/issues/13448
93+
# Can be removed (and code deleted) once fixed.
94+
"_sphinx_13448_workaround",
9295
]
9396

9497
LANGUAGE_CODE = "en-us"

0 commit comments

Comments
 (0)