element-web icon indicating copy to clipboard operation
element-web copied to clipboard

Web client declares lang="en" in HTML, triggering browser translation that mutates displayed message text

Open smartcontrol92 opened this issue 5 months ago • 0 comments

Steps to reproduce

  1. Open Element Web in Firefox (or Chrome/Edge with built-in translation enabled). Use a homeserver where the UI language is set to German (or any language other than English).

  2. Observe the page source / document language: the root element is

    even though the UI is displayed in German.
  3. The browser prompts to translate the page (e.g. “Translate this page to German?”). Click “Yes” / enable “Always translate this site”.

  4. Open any room and send a normal text message, e.g. “Du lernst es bald.”

  5. After sending, look at your own message in the timeline. Optionally reload the page with translation still active.

Outcome

What did you expect?

  • The browser should not treat the page as English when the user has selected German (or another language) in Element settings.
  • Sent messages should always display exactly as typed/sent.
  • Browser translation should not be encouraged for a page that is already localised to the user's language.

What happened instead?

  • Because <html lang="en"> is hard-coded, the browser offers to translate the page even when Element is already shown in German.
  • If the user accepts translation, the browser's translation engine modifies visible DOM text — including message bodies in the timeline.
  • The sender then sees different words than they typed (e.g. “Du lernst es bald” → “Du lernst ist kahl”; “Auflösung” → “Aufsicht”).
  • The message may appear as “(edited)” even though the user did not edit it.
  • Recipients often still see the correct text (server content is fine); only the sender's local display is corrupted.
  • This only affects the web client in browsers with page translation; Element Desktop is unaffected.

This is easy to misreport as a message-editing or sync bug. In our case we confirmed the root cause is browser translation triggered by lang="en" on a German-localised UI.

Operating system

No response

Browser information

No response

URL for webapp

No response

Application version

No response

Homeserver

No response

Will you send logs?

Yes

smartcontrol92 avatar Jul 03 '26 09:07 smartcontrol92