Repository navigation
Conversation
mathjazz
left a comment
There was a problem hiding this comment.
Thanks for the patch!
Left a comment inline.
| mark: ( | ||
| <Localized id={l10nId} attrs={{ title: true }} key={++keyCounter}> | ||
| <mark className='placeable' data-match={text}> | ||
| <mark className='placeable' data-match={text} dir='ltr'> |
There was a problem hiding this comment.
What if the number is -1? In RTL text that will put the minus on the right in plain text but on the left with dir="ltr", right?
There was a problem hiding this comment.
Thanks that is a question! Without isolation the minus sign ends up on the right. For Persian the expected form is the opposite way around. The FarsiWeb locale requirements that CLDRs Persian data is based on (linked from https://cldr.unicode.org/translation/language-specific/persian p. 12) Say that the minus sign (U+2212) should go on the side of the digits for example «−۱۲۳٫۴». CLDR does the same for fa, ur he and ar‑Latn by putting an LRM before the minus sign.
Therefore I kept signed numbers isolated as left‑to‑right. Expanded the number pattern to include Persian digits, U+2212 and Persian separators. Unsigned numbers are no longer isolated; ranges like 1-2 remain unchanged and Arabic‑Indic digits are left untouched because CLDR places the minus sign on the side for Arabic‑Indic digits. The value -1 was also being treated as a CLI option. That issue is now fixed. I added tests for all of these changes.
Fixes #4054
In RTL locales the BiDi algorithm was reordering tags and placeholders such as
</strong>, causing them to appear asstrong>…/<in both the translation list and the string list; however, the editor was not affected since CodeMirror had already isolated them as LTR.The addition of
dir="ltr"to the code-like placeables inHighlightalso ensures that they are isolated and thus displayed in the same way as they do in the editor. Whitespace, newlines and punctuation remain unchanged.Screenshots
Before


Persian (fa):
Urdu (ur):
After


Persian (fa):
Urdu (ur):