You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Describe the bug
In
sphinx/locale/__init__.py:26
it uses the language part of the locale code as a fallback, so usingzh_TW
means[ 'zh_TW', 'zh' ]
will be passed togettext.translation
.In CPython,
gettext.translation
usesgettext.find
, which finds the.mo
file for each language specified. Forzh_TW
it finds the.mo
file forzh_TW
normally. However, when it gets tozh
it first normalizes the locale code tozh_CN
, which means it ends up finding the.mo
file forzh_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
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
Expected:
Incorrect:
OS
Linux
Python version
Python 3.9
Sphinx version
4.2
Sphinx extensions
No response
Extra tools
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: