learnyouahaskell / learnyouahaskell.github.io

A community version of the renowned "Learn You a Haskell" (LYAH) tutorials collection!

Home Page:https://learnyouahaskell.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  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 :)