Closed Bug 694986 Opened 8 years ago Closed 8 years ago

[RTL] The right bracket is misplaced in language names

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set

Tracking

(firefox9 affected)

VERIFIED FIXED
Firefox 10
Tracking Status
firefox9 --- affected

People

(Reporter: xti, Assigned: jfkthame)

References

Details

(Keywords: rtl)

Attachments

(2 files)

Attached image screenshot
Steps to reproduce:
1. Open Fennec App
2. Install the Arabic Language pack
3. Restart the app
4. Go to Preferences > Languages
5. Check if the following language names are displayed correctly: Espanol (de Espana), English (US), Portugues (Europeu).

Expected result:
All language names are displayed correctly.

Actual result:
The right bracket is not set in the end, but before the first character as you can see in the attached screenshot.
Build ID: Mozilla/5.0 (Android;Linux armv7l;rv:9.0a2)Gecko/20111017
Firefox/9.0a2 Fennec/9.0a2
Device: Samsung Galaxy S
OS: Android 2.2

Build ID: Mozilla/5.0 (Android;Linux armv7l;rv:10.0a1)Gecko/20111017
Firefox/10.0a1 Fennec/10.0a1
Device: Samsung Galaxy S
OS: Android 2.2

This issue occurs on the latest Aurora and Nightly builds.
Version: Firefox 9 → Trunk
Blocks: 689706
tracking-fennec: --- → ?
Depends on: 694047
Keywords: rtl
The issue here is that LTR language names such as "English (US)" are being displayed in a RTL environment, where the trailing neutral-direction character will take on the surrounding RTL directionality and hence appears at the left-hand side of the string (and is mirrored).

Ideally, fragments of text such as the language names, which may be displayed in either LTR or RTL contexts, should carry their own direction tagging and be displayed in a <span> or similar, with the appropriate directionality. However, this seems like a lot of overhead. A lower-level approach would be something like the attached patch, which just wraps all language names in <LRE>...<PDF> Unicode control characters, so that the name is consistently regarded as a left-to-right fragment, regardless of the environment within which it is embedded.

This does not break purely-RTL names such as Arabic, as the inherent strong directionality of the letters still applies. The only case where it would cause a problem would be if a RTL name were to begin or end with neutral characters such as parens. In this case, there would need to be additional control characters within the language name itself (but such a name would already be a problem if we had any, as they'd display incorrectly within the existing English UI).

Given that the vast majority of language names will be LTR, it seems reasonable to design the default behavior so that these will display correctly, and only the rare (currently non-existent?) exceptional case of a RTL name with neutral characters at start/end will need special care.
Attachment #567747 - Flags: review?(mark.finkle)
BTW, another option would presumably be to explicitly control the overall directionality of the language names via css. I didn't try this, as it seemed a much more invasive approach for no real benefit. I think we'd need to wrap each name in an additional element so that we could set its direction, as we don't want to override the RTL directionality of the list as a whole.
Attachment #567747 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/387f388bca1f
Assignee: nobody → jfkthame
Target Milestone: --- → Firefox 10
https://hg.mozilla.org/mozilla-central/rev/387f388bca1f
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Verified fixed on:
Mozilla/5.0 (Android;Linux armv7l;rv:10.0a1)Gecko/20111031
Firefox/10.0a1 Fennec/10.0a1
Devices: Acer ICONIA A500
OS: Android 3.1
Status: RESOLVED → VERIFIED
Depends on: 859093
No longer depends on: 859093
tracking-fennec: ? → ---
You need to log in before you can comment on or make changes to this bug.