learnyouahaskell.github.io icon indicating copy to clipboard operation
learnyouahaskell.github.io copied to clipboard

Google and other browser-enabled translators modify the code to translate it

Open wennerryle opened this issue 9 months ago • 0 comments

Describe the bug Google and other browser-enabled translators modify the code to translate it

To Reproduce Steps to reproduce the behavior:

  1. Go to any page with code snippets
  2. Click on "Translate this page"
  3. Change the language
  4. 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 :)

wennerryle avatar Apr 29 '24 21:04 wennerryle