Skip to content

feat: use translate=no attribute in code sensitive renderings #2697

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

displague
Copy link

@displague displague commented Jun 5, 2025

What/Why/How?

This VS Code Copilot created PR is a proof-of-concept of the translate="no" feature described in the issue linked below. This is a light approach to enable tools like Google Translate (and others) to better handle Redoc rendered OpenAPI specs using a W3C standard HTML attribute.

(Project owners: feel free to close this if you have a better sense of what changes are appropriate and it is faster to iterate on this idea without an outside collaborator.)

Prompt (~):

Implement the recommendation in #2696 using the translate="no" approach described in the issue. I believe all of the relevant blocks of code will can be found at locations where "<span" is included in the code.

Reference

Fixes #2696

Tests

Using npm start and reviewing the rendered spec (museum.yaml) for markup.

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested
  • All new/updated code is covered with tests

Copy link
Author

@displague displague left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is in draft and not considered to be complete. I believe I've seen <div> used for some text elements in Redoc renderings. In the prompt for this change I hinted that likely candidates for change would be <span> elements.

I don't believe <code> needs to be decorated the same way, but we could easily add that if we can not assume translation services block those elements.

@displague
Copy link
Author

I see the translate=no appearing in the right panel, the JSON example blocks, but I'm not seeing it in the left side where the descriptions are. I would appreciate any pointers.

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

Successfully merging this pull request may close these issues.

Add translate=no attribute or notranslate classes in non-descriptive rendered fields
1 participant