fix(mobile): Arabic reads in its direction: arrows turn round, Latin names keep their ends, figures stay whole

In the touch shell the back, forward, disclosure, date-range and flow
arrows kept pointing right in Arabic, so Settle up showed the debt the
wrong way round and Vacay's year arrows pointed inward. The shell now
mirrors lucide's direction arrows in right-to-left languages; an icon
that names its own treatment keeps it, and the lightbox arrows stay on
their physical sides.

Latin user text in Arabic rows lost its beginning when cut and moved its
punctuation to the wrong end. Names, titles, addresses and file names take
their direction from their own text (dir=auto) and still line up with the
row; markdown paragraphs, chat messages, poll options and journal stories
are isolated; signed balances, amounts, sizes, rates and leg figures read
as one left-to-right run; URL fields read left to right. Name pairs joined
by an arrow isolate each name and point from the first to the second.

The hero progress and poll result bars fill from the start edge. Arabic
and Hebrew uppercase caption labels grow a step and take the muted ink,
and a todo's due date in a notification is written in the reader's
language instead of as YYYY-MM-DD.
This commit is contained in:
Maurice
2026-11-07 23:21:33 +01:00
parent 2a6c771ad9
commit bf00412863
61 changed files with 496 additions and 128 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* "Sam → Ada", "Kyoto → Osaka": two names with an arrow from the first to the
* second, as one string (a row's label, an aria-label).
*
* In an Arabic UI the plain form reads backwards. A Latin name and an Arabic one
* reorder around the arrow, and the arrow itself never turns, so "Sam Carter →
* أنت" shows the arrow pointing back at Sam. There each name goes into its own
* isolate (U+2068 … U+2069), so the pair lines up in reading order whatever
* script the names are in, and the arrow points left, from the first name to
* the second. A left-to-right UI gets the plain string.
*/
const FSI = '⁨';
const PDI = '⁩';
export function isRtlDocument(): boolean {
return typeof document !== 'undefined' && document.documentElement.dir === 'rtl';
}
export function flowText(parts: readonly string[], rtl: boolean = isRtlDocument()): string {
if (!rtl) return parts.join(' → ');
return parts.map((part) => `${FSI}${part}${PDI}`).join(' ← ');
}