Skip to content

TOOLSDEV-385: Add translate="no" attribute to code and pre elements #136

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

Merged
merged 2 commits into from
May 5, 2025

Conversation

nadamsoreilly
Copy link
Contributor

QAed on Staging. This does prevent machine translation on the Platform without causing any problems I could find.

Prod Merge for #134 and #135

This commit adds the `translate="no"` attribute to both inline code elements and code blocks to prevent machine translation tools from attempting to translate code
snippets.

Changes include:
1. Added `translate="no"` attribute to code blocks in block_listing.html.erb
2. Added `translate="no"` attribute to inline code elements in inline_quoted.html.erb
3. Added comprehensive tests to verify the attribute is correctly applied:
   - Test for inline code elements verifies the attribute is present on <code> tags
   - Test for code blocks verifies the attribute is present on <pre> tags with data-type="programlisting"
This commit adds the `translate="no"` attribute to block literal templates to prevent machine translation tools from attempting to translate content within literal blocks.
Literal blocks are typically used for command output, log files, and other pre-formatted text where exact spacing and formatting must be preserved.

Changes include:
- Added `translate="no"` attribute to the <pre> element in block_literal.html.erb
- Added a comprehensive test in htmlbook_spec.rb to verify the attribute is correctly applied to literal blocks delimited with `....`

This change complements the previous commits that added the same attribute to:
1. Inline code elements (via inline_quoted.html.erb)
2. Code blocks (via block_listing.html.erb)

Together, these changes ensure that all code-like content throughout the documentation is excluded from translation by browser-based translation tools and other translation
services, preserving the integrity of code examples, command output, and other technical content.
@nadamsoreilly nadamsoreilly requested review from a team as code owners May 5, 2025 15:39
@nadamsoreilly nadamsoreilly merged commit 01eee3f into master May 5, 2025
2 checks passed
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.

2 participants