Skip to content

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

@wennerryle

Description

@wennerryle

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions