Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Allow Chrome page translator to translate messages in rooms #11113

2 changes: 2 additions & 0 deletions src/HtmlUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ export function bodyToHtml(content: IContent, highlights: Optional<string[]>, op
"mx_EventTile_body": true,
"mx_EventTile_bigEmoji": emojiBody,
"markdown-body": isHtmlMessage && !emojiBody,
// Override the global `notranslate` class set by the top-level `matrixchat` div.
"translate": true,
Copy link
Member

Choose a reason for hiding this comment

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

Please could you add a comment explaining a bit more about what this does, and why it is necessary? Surely it isn't normally necessary to mark things for translation explicitly?

Do I understand correctly that this is overriding a notranslate class somewhere else? Please say that in a comment if so.

Basically: imagine you are a developer reading this code for the first time, without the benefit of having read all of the conversation on element-hq/element-web#25594, and that you are trying to understand what this is for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I understand correctly that this is overriding a notranslate class somewhere else? Please say that in a comment if so.

@richvdh Yes.

The entire application currently has translation disabled using the notranslate class placed in the div#matrixchat element.
The translate class overrides the notranslate class that is in this element's ancestor.

richvdh marked this conversation as resolved.
Show resolved Hide resolved
});

let emojiBodyElements: JSX.Element[] | undefined;
Expand Down
Loading