HTML Translate

Which HTML Attributes Should Be Translated?

One of the most common HTML localization mistakes is translating the wrong attributes.

Some attributes contain user-facing text and should be reviewed during translation. Others are purely technical and should stay unchanged.

Attributes that often should be translated

These may need translation when they are meaningful to users:

  • alt
  • title
  • some placeholder values
  • selected accessibility-related text when it is surfaced to users

Attributes that usually should not be translated

These usually control structure, styling, behavior, or routing:

  • class
  • id
  • data-*
  • most href values
  • tracking identifiers
  • inline configuration payloads

Why translating the wrong attributes is risky

If you translate a technical attribute, you can accidentally break:

  • CSS selectors
  • JavaScript behavior
  • analytics tracking
  • automation hooks
  • navigation or route stability

That kind of issue is easy to miss until someone clicks around the translated page.

What about href?

Translate the visible anchor text first. Only translate the href value if your site is intentionally using localized URLs and you have a routing plan for them.

What about alt and title?

These often deserve translation because they can affect usability and accessibility.

Keep them:

  • concise
  • accurate
  • natural in the target language
  • aligned with the visible content on the page

Practical rule of thumb

Ask one question: Will a user meaningfully read this value?

If yes, it may need translation. If no, it is probably technical and should remain unchanged.

Final takeaway

Attribute handling is one of the most important parts of safe HTML localization. Translate user-facing attributes carefully, and leave technical attributes alone unless you deliberately manage them.

For broader workflows, see:

More guides

Looking for more? Visit the full HTML Translate blog.