Google and other browser-enabled translators modify the code to translate it
wennerryle opened this issue · comments
Describe the bug
Google and other browser-enabled translators modify the code to translate it
To Reproduce
Steps to reproduce the behavior:
- Go to any page with code snippets
- Click on "Translate this page"
- Change the language
- Observe that the code snippets have been modified (translated).
Expected behavior
The code snippets should not be translated.
Additional context
This issue can be fixed by using the translate="no" attribute on the code snippet containers.
<div class="dp-highlighter nogutter" translate="no">
...
</div>
This code snippet may fix the problem, but the highlight library should highlight the code first.
document.querySelectorAll('.dp-highlighter').forEach(it => it.setAttribute('translate', 'no'))
I've tried to fix it myself, but I haven't figured out how to make it work properly.
Thanks for cool design :)