Skip to content
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

Spurious spaces in code blocks when translated with Google Translate #5727

Closed
astrofrog opened this issue Dec 6, 2018 · 7 comments
Closed

Comments

@astrofrog
Copy link
Contributor

In #4424, Sphinx introduced the class='notranslate' on code blocks, which is great and works to some extent. However, there is a residual issue that Google Translate appears to introduce spaces between parts of the code:

screen shot 2018-12-05 at 17 56 15

which means that copy/pasted code can't actually be used without cleaning it up first. It would be great if this is something that could be prevented on the Sphinx side.

(cc-ing @tk0miya as the author of #4424)

@tk0miya
Copy link
Member

tk0miya commented Dec 15, 2018

Unfortunately, I'm not good at google translate. Do you have any good idea?

@TimKam
Copy link
Member

TimKam commented Dec 23, 2018

@astrofrog Could you point to a specific documentation page that is available online and specify the language you are translating to? This does not seem to be a problem that occurs always, no matter the type of code block and language.

@astrofrog
Copy link
Contributor Author

astrofrog commented Dec 29, 2018

@tk0miya
Copy link
Member

tk0miya commented Jan 2, 2019

Hmm... google translate inserts a space character between <span> tags. It makes the code-block sparse.
It seems no options for google translate to control the behavior. If anyone knows it, please let me know.

@TimKam
Copy link
Member

TimKam commented Jan 2, 2019

I also had a look and could not find any straight-forward fix for this. I certainly see this as a problem with Google translate and not with Sphinx. It's probably technically possible to implement work-arounds in Sphinx (e.g.: writing a script that waits some seconds after page load, checks the URL and removes space characters in elements with specific classes), but these would be rather hacky and unreliable.
What do you think, @tk0miya? Should we try a work-around or rather conclude that this issue is a) not caused by Sphinx and b) of too little importance?

@tk0miya
Copy link
Member

tk0miya commented Jan 2, 2019

I feel this is a problem of Google Translate. So there are nothing to do from sphinx side.

In addition, workaround is fragile and hacky. So I don't think we should not that as sphinx-core.

@TimKam
Copy link
Member

TimKam commented Jan 2, 2019

Makes sense imho. Then I mark it as wontfix and close it.

@TimKam TimKam closed this as completed Jan 2, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants