Skip to content

fix: populate script isRtl in controller and svelte - #152

Merged
andrew-polk merged 1 commit into
mainfrom
rtl
Jul 24, 2026
Merged

fix: populate script isRtl in controller and svelte#152
andrew-polk merged 1 commit into
mainfrom
rtl

Conversation

@andrew-polk

@andrew-polk andrew-polk commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What

Adds feature parity for the newly-added IScript.isRtl property across the controller and Svelte language choosers. isRtl was previously populated only by the React hook.

Changes

  • Controller (language-chooser-controller): a scriptWithReadingDirection() helper stamps isRtl (via isRTLScript(script.code)) onto the selected script at every path a script becomes selected — normal selection, auto-selection of a language's sole script, and customize-modal submit. It returns a fresh copy rather than mutating shared language data, which matches the Field change-detection contract. Svelte consumers (which derive the emitted orthography from selectedScript) now receive the reading direction automatically.
  • Svelte demo (BasicDemo.svelte): the "Submitted selection" panel shows the script as Name (RTL/LTR), matching the React DialogDemo.
  • find-language (isRTLScript): wrapped Intl.Locale construction in try/catch so a malformed/unknown script code returns false instead of throwing. Behavior for valid codes is unchanged.
  • Tests: updated controller specs whose exact-equality assertions now include the populated isRtl, and added a test asserting isRtl: true for an RTL script (Arabic).

Verification

  • controller: typecheck ✓, lint ✓, 95 tests ✓
  • find-language: typecheck ✓, lint ✓, 172 tests ✓
  • react-hook: 16 tests ✓ (shared isRTLScript change)
  • svelte: typecheck ✓, svelte-check ✓, tests ✓

This change is Reviewable


Devin review

@andrew-polk

Copy link
Copy Markdown
Contributor Author

[Claude Opus 4.8] Consulted Devin on 2026-07-24 10:59 USMST up to commit 524b0418c5a1f1e70b3142f1f9e7eeb87ba4ce1e.

Result: 0 Bugs, 0 Investigate flags, 1 Informational (not mirrored — low signal). The informational note observes that isRtl is now always populated as a concrete boolean (never left undefined) on the controller's selection paths; Devin itself concludes this is consistent with the existing React hook and not a bug. It is the intended parity behavior, so nothing to act on. Nothing to mirror to the PR.

Completes feature parity for IScript.isRtl, which shipped in 0.4.0 for the
React hook only. The language-chooser controller now stamps isRtl on the
selected script at every selection path (normal selection, sole-script
auto-selection, and customize-modal submit), so Svelte and other controller
consumers receive the reading direction in the emitted orthography. The Svelte
demo shows the script's RTL/LTR direction, matching the React DialogDemo. Also
hardens isRTLScript to return false (instead of throwing) on a malformed or
unknown script code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@andrew-polk andrew-polk changed the title feat: populate script isRtl in controller and svelte fix: populate script isRtl in controller and svelte Jul 24, 2026
@andrew-polk

Copy link
Copy Markdown
Contributor Author

[Claude Opus 4.8] Consulted Devin on 2026-07-24 11:14 USMST up to commit 6b5cf77e677a7032df3588efe6a1563a93393a06 (after squashing to a single fix: commit; content unchanged).

Result: 0 Bugs, 0 Investigate flags, 3 Informational (not mirrored — low signal, no action). Re-review clean.

@andrew-polk
andrew-polk marked this pull request as ready for review July 24, 2026 18:16
@andrew-polk
andrew-polk merged commit 970e44a into main Jul 24, 2026
1 check passed
@andrew-polk
andrew-polk deleted the rtl branch July 24, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant