-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
Remove unnecessary trailing backslashes #135781
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.
I don't see any noticeable change in the rendered documentation, but if this affects translations then it's worthwhile. @StanFromIreland, can you confirm?
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.
When gettext extracts it, it escapes the \
. The result looks like this:
#: ../../c-api/extension-modules.rst:245
msgid ""
"``_testsinglephase`` is an internal module used \\ in CPython's self-test "
"suite; your installation may or may not \\ include it."
msgstr ""
This will confuse translators, and they may leave it in, which will result in them appearing in the build. A prior similar pr: #135013 We should probably note this in the devguide, I will add it to my list.
Off-topic, but maybe also something to be fixed in Sphinx's gettext extraction? ISTM the backslashes should not be extracted, what do you think? |
I agree the behaviour is weird and there is a bug in Sphinx which should also be fixed, but I’m not quite sure what we would want exactly, I will look into what GNU xgettext does. |
Ok, I'm going to merge this. @picnixz, as a Sphinx wizard, could you possibly look into fixing this upstream? |
Thanks @rffontenelle for the PR, and @ZeroIntensity for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
This fixes Sphinx's gettext extraction for translations. (cherry picked from commit 6a16b3c) Co-authored-by: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
GH-135791 is a backport of this pull request to the 3.14 branch. |
Yes, I can. IIRC it should be in https://github.com/sphinx-doc/sphinx/blob/c384ab96c328c3abc91b39c9e3e527863df30af1/sphinx/util/nodes.py#L292. I'll make the heuristic of only removing trailing backslashes from it. |
@ZeroIntensity or @rffontenelle could you open a Sphinx issue and tag me there? (just check that there isn't one existing) |
The trailing backlash doesn't seem to be needed. Besides, they are extracted by Sphinx
gettext
builder as part of the translation string, which can lead to wrong translation.📚 Documentation preview 📚: https://cpython-previews--135781.org.readthedocs.build/