Closed Bug 1975487 Opened 1 year ago Closed 9 months ago

Translating Arabic to English causes punctuation to be presented incorrectly

Categories

(Firefox :: Translations, defect)

defect

Tracking

()

VERIFIED FIXED
146 Branch
Tracking Status
firefox145 --- verified
firefox146 --- verified

People

(Reporter: gregtatum, Assigned: nordzilla)

References

Details

Attachments

(2 files)

Translating an RTL page to LTR causes punctuation to be presented incorrectly.

For instance, with the phrase: "What is Open Source?" the "?" is not strongly LTR so it gets placed at the beginning of the sentence. "?What is Open Source". This is because the block element is RTL, but the text is ambiguous until the first strongly LTR character.

The solution here is to use bidi isolate characters.

U+2066 - Left-to-Right Isolate (LRI)
U+2067 - Right-to-Left Isolate (RLI)
U+2069 - Pop Directional Isolate (PDI)

So in this case:

"\u2066What is Open Source?\u2069"

This would fix the presentation of the text. For LTR to RTL you would use the corresponding U+2067.

Here is a really good test page: https://linux-2-day.com/

This patch applies the target-language script direction
to elements with translatable content within within the
TranslationsDocument. This preserves the core layout of
the page, while still ensuring that translated text
displays correctly.

Assignee: nobody → enordin
Attachment #9518124 - Attachment description: WIP: Bug 1975487 - Apply script direciton to translated elements r=#translations-reviewers! → Bug 1975487 - Apply script direciton to translated elements r=#translations-reviewers!
Status: NEW → ASSIGNED
Pushed by enordin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/dd670349f93d https://hg.mozilla.org/integration/autoland/rev/e1f68be45980 Apply script direciton to translated elements r=translations-reviewers,gregtatum
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch

firefox-beta Uplift Approval Request

  • User impact if declined: This is a non-risky patch that contains substantial quality-of-life improvements for translating between LTR and RTL languages (e.g. Arabic ↔ English).

Given the low risk, and that we are in very early beta, I would like to get this shipped sooner than later.

  • Code covered by automated testing: yes
  • Fix verified in Nightly: no
  • Needs manual QE test: yes
  • Steps to reproduce for manual QE testing: Steps are provided in the bug comments, RE: https://linux-2-day.com
  • Risk associated with taking this patch: low
  • Explanation of risk level: This is a very low-risk patch. The only changes are adding attributes to HTML elements which is quite safe, and this patch is covered by automated testing.
  • String changes made/needed: None.
  • Is Android affected?: yes
Attachment #9520311 - Flags: approval-mozilla-beta?
Flags: qe-verify+

This patch applies the target-language script direction
to elements with translatable content within within the
TranslationsDocument. This preserves the core layout of
the page, while still ensuring that translated text
displays correctly.

Original Revision: https://phabricator.services.mozilla.com/D267441

Attachment #9520311 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
QA Whiteboard: [uplift][qa-ver-needed-c146/b145]
QA Contact: cgeorgiu
Blocks: 1994794

I've reproduced this issue using an affected Nightly build (2025-07-03) on Win 11.

The issue is verified as fixed on latest Nightly 146.0a1 and Beta 145.0b3 under Win 11, macOS 28 and Ubuntu 24.

Status: RESOLVED → VERIFIED
QA Whiteboard: [uplift][qa-ver-needed-c146/b145] → [uplift][qa-ver-done-c146/b145]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: