-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
In sphinx/locale/__init__.py:26 it uses the language part of the locale code as a fallback, so using zh_TW means [ 'zh_TW', 'zh' ] will be passed to gettext.translation.
In CPython, gettext.translation uses gettext.find, which finds the .mo file for each language specified. For zh_TW it finds the .mo file for zh_TW normally. However, when it gets to zh it first normalizes the locale code to zh_CN, which means it ends up finding the .mo file for zh_CN and adding that as a fallback.
gettext.translation already includes the language-without-country-code fallback. The "fallback" that Sphinx adds is unneeded and incorrect.
How to Reproduce
$ https://invent.kde.org/documentation/docs-krita-org.git -b krita/5.0
$ cd docs-krita-org
$ pip install sphinx
$ sphinx-intl build
$ make html SPHINXOPTS="-D language=zh_TW"
$ # open _build/html/user_manual/getting_started.html and see Simplified Chinese mixed in the text
Expected behavior
Untranslated text shall use the original English text and not "fall back" to Simplified Chinese.
Your project
https://invent.kde.org/documentation/docs-krita-org
Screenshots
OS
Linux
Python version
Python 3.9
Sphinx version
4.2
Sphinx extensions
No response
Extra tools
No response
Additional context
No response

