-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-139181: Allow translation of html_short_title in docs config #139195
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, however there are several issue:
- The version number, which does not need to be translated, changes quite frequently. Just translating "Documentation" would be much easier, rather than translating every few months. e.g.:
html_short_title = _('%(release)s Documentation') % {'release': release}
- Testing locally I see that the string is not extracted by the gettext builder, it's also not particularly clear what catalogue it's using? I tried putting it into the sphinx domain but that didn't work.
- This also breaks epub builds.
- There are also other strings that can be translated, e.g. "Python Documentation Authors".
Thank you for the feedback! I’ll look into these issues and see if I can fix them. Any guidance you can provide would be greatly appreciated. |
The trouble with translating just part of the string is that for some languages |
I was thinking:
translators are used to named placeholders. |
epub_author = _('Python Documentation Authors') | ||
epub_publisher = _('Python Software Foundation') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI is failing with:
WARNING: The config value `epub_author' has type `_TranslationProxy'; expected `str'.
WARNING: The config value `epub_publisher' has type `_TranslationProxy'; expected `str'.
Does Sphinx need an update for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not entirely sure about this. I added the changes based on a suggestion, but if they’re not required, I can remove them.
@StanFromIreland Could you please confirm whether these changes are actually needed ?
You may find people's workarounds (Sphinx provides no native support) here helpful: sphinx-doc/sphinx#1260 |
This appears to be something that needs fixing in Sphinx first, so I'll close this PR for now. A |
#139181
This PR wraps the
html_short_title
string in conf.py with theSphinx translation function _().
Please let me know if my approach or fix needs any improvements . I’m open to feedback and happy to make changes based on suggestions.
Thankyou !
📚 Documentation preview 📚: https://cpython-previews--139195.org.readthedocs.build/