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

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

Open
wennerryle opened this issue Apr 29, 2024 · 0 comments

Comments

@wennerryle
Copy link

wennerryle commented Apr 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant