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

rustdoc, when I use google translate, that translate the doc as well as the code. #88020

Closed
indexroot opened this issue Aug 14, 2021 · 4 comments · Fixed by #88093
Closed

rustdoc, when I use google translate, that translate the doc as well as the code. #88020

indexroot opened this issue Aug 14, 2021 · 4 comments · Fixed by #88093
Assignees
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@indexroot
Copy link

indexroot commented Aug 14, 2021

rustdoc, when I use google translate.

the rust code and crates name. translated like this:

image

the rust-book work well.
I found that using <code></code> protect code do not translate.

Could you update the rustdoc using <code> tag to fix it?

@indexroot indexroot changed the title rustdoc, using google translate all rustdoc, when I using google translate, that translate the doc as well as the code. Aug 14, 2021
@indexroot indexroot changed the title rustdoc, when I using google translate, that translate the doc as well as the code. rustdoc, when I use google translate, that translate the doc as well as the code. Aug 14, 2021
@inquisitivecrystal inquisitivecrystal added A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 14, 2021
@jyn514
Copy link
Member

jyn514 commented Aug 16, 2021

I don't understand the request, sorry. Are you saying it's incorrect that google translates code blocks, not just the documentation? I don't know how rustdoc could prevent that, we don't control google translate.

@crlf0710
Copy link
Member

crlf0710 commented Aug 16, 2021

I tested the code block output at https://spec.commonmark.org/dingus/ . It seems the CommonMark reference implementation generates two levels of elements, the outer level with a pre tag. the inner level with a code tag. Currently it seems rustdoc only generates the pre tag without the code one.

Maybe it's worth aligning the behavior with the reference implementation.

@jyn514
Copy link
Member

jyn514 commented Aug 16, 2021

Ah ok - I'm surprised to hear that since we use pulldown-cmark, which follows the commonmark standard. Someone would have to investigate whether this is specific to rustdoc or whether all tools using pulldown have this issue.

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. labels Aug 16, 2021
@Kobzol
Copy link
Contributor

Kobzol commented Aug 16, 2021

I think that using <code> is a good idea, not just for translation, but generally for the semantic meaning of the HTML. <pre><code> is pretty standard HTML for code blocks.

pulldown-cmark uses <code> and even rustdoc tests use it. But rustdoc currently only emits <pre>. I'll try to change it.

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustdoc-ui Area: Rustdoc UI (generated HTML) C-enhancement Category: An issue proposing an enhancement or a PR with one. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-help-wanted Call for participation: Help is requested to fix this issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants