Repository navigation
feat(engine): Arabic interface, right to left - #36
Merged
Merged
Conversation
…checked - engine.js / contents.js: an Arabic block in TRANSLATIONS with its plural forms (one, two, few, many, other), and <html lang="ar"> sets dir="rtl" unless the page set one. - engine.css / contents.css / units.css: physical left/right rules on cards, help, finish and contents become logical (border-inline-start, inset-inline-end, ...), so English renders as before and Arabic mirrors. The stage, the player bar and mathematics (svg.m, answer lines) stay left to right, so drawings, seeking and the arrow keys mean the same in every language. Arabic letters join: no letter spacing on the kickers; system Arabic faces, no font files. - UI (canvas measuring and stage text) follows --ui, so an Arabic page measures in its own face. - tts.py: ؟ ends a caption. Edge's ar-SA voices were checked live: their word boundaries match the text with diacritics, Arabic-Indic digits and inline maths. - Checks: Arabic lesson and book in check_i18n.py (English output still identical to main), check_tts_text.py (captions and marks without a voice, added to CI), check_tapwords.py covers every interface language. - Docs: engine.md, publish.md, sound.md, diagrams.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SzbEL6yNpeuSXaqqgkchqD
mostafaelqaseir
force-pushed
the
arabic-rtl
branch
from
October 29, 2026 13:59
beeef61 to
89d8b44
Compare
DozenTwelve
added a commit
that referenced
this pull request
Oct 31, 2026
PR #36 predates the book, so its engine copy is synced here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thank you, Mostafa! Merged and live at https://papermorph.diamonddoge.org/. A careful piece of work: logical properties so English stays byte-identical, the stage and maths kept left to right, and checks for all of it. Much appreciated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Arabic interface, right to left
Adds Arabic as a built-in interface language and makes the player and the contents page read right to left for it, without changing what English (or any other language) renders.
What changes
arblock inTRANSLATIONS(engine.js,contents.js) with Arabic's plural forms (one, two, few 3–10, many 11–99, other).<html lang="ar">setsdir="rtl"unless the page sets its owndir(RTL_LANGUAGES, one list in each file, kept in step like the translations).border-inline-start,inset-inline-end,padding-inline-start,text-align: start/end). In left-to-right pages they compute to the same values, so English is unchanged; in Arabic the cards, captions, help, cover and contents mirror.svg.mexpressions and.blineanswer lines in cards). Drawings keep their coordinates, seeking and ←/→ mean the same in every language (as YouTube does in Arabic), and3 + 4 = [box]keeps its order, as in Arabic school books. Without this the first quick check rendered its equation scrambled.book.css/ theme still wins.UIfollows--ui. The engine's canvas measuring (and stage text) used a hard-coded face list; it now reads--ui, so an Arabic page (or a book that sets--ui) measures in the face it shows. The value is normalised so English markup stays byte-identical.tts.py:؟ends a caption as?does. I ran Edge'sar-SA-HamedNeuralandar-SA-ZariyahNeurallive: every word boundary matched the text as written, with diacritics (إِنَّ), Arabic-Indic digits (٥) and inline maths (x + 3 = 7), so[[marks]]need no special handling. An oldedge-ttsgets HTTP 403 at the handshake;uv run --with edge-tts(as documented) takes the current one.Checks
engine/check_i18n.py: new Arabic lesson and Arabic book checks (dir, LTR stage/bar, plurals, numbers, a key on an Arabic layout, the card's accent edge on the right, the equation's order, the step counter's order, the finish card, the cover arrow, contents and progress). "English unchanged against main" still passes, byte for byte..github/scripts/check_tts_text.py(new, stdlib only, added to CI): captions and marks from narration text with hand-written word timings, Arabic and English, no network.engine/check_tapwords.py: the interface-strings check covers every language inTRANSLATIONSinstead of a fixed list.check_skill.py,check_site.py(engine copies synced withengine.py site), ruff,check_latex.py,check_tapwords.py,check_volume.py: all pass.Docs
core/engine.md(what RTL does and keeps),core/publish.md(built-in languages),core/sound.md(Arabic voices and what was checked),lessons/diagrams.md(an Arabic page reads from the right, its maths from the left).Not in this PR
num()and answer boxes (digits stay 0–9 with a point).eleven.pyalignment for Arabic (not tested).engine-v*release.🤖 Generated with Claude Code
https://claude.ai/code/session_01SzbEL6yNpeuSXaqqgkchqD