golang / tour

[mirror] A Tour of Go
BSD 3-Clause "New" or "Revised" License
1.54k stars 522 forks source link

Add `translate="no"` for prevent auto-translating code #1366

Open no-yan opened 2 years ago

no-yan commented 2 years ago

Currently, when you try to machine-translate websites in the Tour of Go, the code editor is also translated. This is not ideal for learning code.

In this Issue, I propose to use the translate attribute in html. By adding translate="no" to the code editor, the code will not be translated, but the explanations will be translated without problems. (Note that the way of using this attribute with a code block is also how it is described in the specification.)

This addition would be helpful for learners who want to learn in a language that has no translations yet, or who are having trouble with incomplete translations.

no-yan commented 2 years ago

Here is a example of diff. On the left, you can see that the` code is not translated.

image (The left has 'translate="no"' and the right is the original)