Repository navigation
fix(i18n): lay out a message of Persian or Arabic digits alone back to front (#3404) - #3652
choupeanut wants to merge 2 commits into
Conversation
…o front (opengeos#3404) has_rtl, the gate in front of visual, fit and the catalog, left those digits out though back_to_front reads a line that starts with one as right to left.
…opengeos#3404) fit_line cuts a Latin-led row before right-to-left letters, which paint backwards there; the digits read in logical order, so only has_rtl_letter ends the row.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
📖 Docs previewCommit |
Summary
has_rtl, the cheap check in front ofvisual,fit, the catalog andparagraph, left the Persian and Arabic digits out, thoughback_to_front(the toolkit's direction guess) reads a line that starts with one as right to left. A message of those digits alone therefore came back unchanged and painted backwards, while the same digits were reversed beside a letter or on a wrapped row of their own.crates/data/src/display_marks.rs:has_rtlnow counts those digits, through a smallrtl_strongthatstrongshares, so the checks agree withvisual_line.has_rtl_letter(new) keeps the old meaning, a letter of a right-to-left script, forfit_lineincrates/ui-egui/src/i18n/rtl.rs: a row that starts with a Latin word ends before a right-to-left letter (it would paint backwards there), but Persian and Arabic digits in such a row read in logical order and stay on it.paragraphnow fits and right-aligns a paragraph of digits alone, like other right-to-left text.Surfaces: the desktop app, the browser and the phone share
i18n::visual. The command line, Python, MCP, the Assistant and plugins don't paint text; display text that leaves the screen is put back bylogical, covered by a test. No command or parameter changes, no new interface text.Testing
Tests added in
crates/ui-egui/src/i18n/rtl.rsandboundary_tests.rs; each failed on the code before the change.a_message_of_digits_alone_is_put_in_display_form(visual,fit,has_rtl, a single digit, ASCII digits, a multi-line message, a left-to-right-led line, a line with a mark of its data's own)a_message_of_digits_alone_comes_back_in_logical_order(logicalround trip)a_latin_row_keeps_the_digits_that_fit_on_it(fitkeeps a Persian-digit word on a Latin-led row)Run:
cargo test -p rustgis-ui-egui --lib i18n,cargo clippy -p rustgis-data -p rustgis-ui-egui --all-targets -- -D warnings,cargo fmt --all -- --check. Not run locally:cargo xtask ciorcargo xtask changed, the other crates' tests, the wasm build; CI covers them.UI evidence
No screenshot was taken, and the change was not checked in the running app: the tests assert the text handed to the toolkit (for example ۱۲۳ becomes ۳۲۱, which the toolkit's back-to-front layout reads back in order). It affects only text made of Persian or Arabic digits alone.
Related issue
Closes #3404
Summary by CodeRabbit