Skip to content

An AI skill that turns books into animated, narrated, interactive web experiences

chore(site): Little Horse takes the Arabic-ready engine

yzrd8e66c9095b7
diff --git a/site/little-horse/lib/contents.css b/site/little-horse/lib/contents.css
index d8f7f70..5c5a616 100644
--- a/site/little-horse/lib/contents.css
+++ b/site/little-horse/lib/contents.css
@@ -78,12 +78,12 @@ h1 i { color: var(--task); font-style: italic; }
.home .mascot { view-transition-name: guide; }
.home strong { font: 500 22px/1.1 var(--book); view-transition-name: book; }
.home strong i { color: var(--task); }
-.prog { margin-left: auto; color: var(--dim); font-size: 15px; white-space: nowrap; }
+.prog { margin-inline-start: auto; color: var(--dim); font-size: 15px; white-space: nowrap; }
.prog b { color: var(--good); font-weight: 600; }
main#contents { padding-bottom: 80px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 12px; }
.ch { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; column-gap: 16px; row-gap: 8px; min-height: 112px;
- padding: 16px 18px 14px 16px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--edge); border-left: 6px solid var(--c);
+ padding: 16px 18px 14px 16px; border-radius: 16px; background: var(--panel); border: 1.5px solid var(--edge); border-inline-start: 6px solid var(--c);
text-decoration: none; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.ch:hover { transform: translateY(-3px); border-color: var(--c); box-shadow: 0 14px 34px var(--lift); }
.ch b { grid-row: span 2; min-width: 1.15em; font: 500 42px/1 var(--book); color: var(--c); font-variant-numeric: lining-nums tabular-nums; }
@@ -102,16 +102,16 @@ main#contents { padding-bottom: 80px; }
.refs-more a:hover { border-color: var(--dim); }
.refs-more b { font: 500 22px/1.2 var(--book); }
.refs-more span { color: var(--dim); font-size: 15px; }
-.refs-more i { margin-left: auto; font-style: normal; color: var(--quiz); font-weight: 600; font-size: 15px; }
+.refs-more i { margin-inline-start: auto; font-style: normal; color: var(--quiz); font-weight: 600; font-size: 15px; }
#refpage { padding-bottom: 80px; }
.top .back { display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 600; text-decoration: none; color: var(--quiz); border-radius: 8px; }
-.top .rp-book { margin-left: auto; font: 500 18px/1.2 var(--book); color: var(--dim); }
+.top .rp-book { margin-inline-start: auto; font: 500 18px/1.2 var(--book); color: var(--dim); }
.top .rp-book i { color: var(--task); }
.refs { max-width: 1212px; margin: 32px auto 0; padding: 0 16px; }
.refs h1 { margin: 0 0 8px; font: 500 clamp(32px, 5vw, 44px)/1.1 var(--book); view-transition-name: none; }
.refs .lead { margin: 0 0 26px; max-width: 46em; color: var(--dim); }
.refs ol { margin: 0; padding: 0; list-style: none; color: var(--dim); font-size: 16px; line-height: 1.5; }
-.refs li { margin: 0 0 10px; padding-left: 2em; text-indent: -2em; }
+.refs li { margin: 0 0 10px; padding-inline-start: 2em; text-indent: -2em; }
.refs a { color: var(--chalk); text-underline-offset: 3px; overflow-wrap: anywhere; }
.refs a:hover { color: var(--quiz); }
.stagger .top { animation: rise .6s var(--ease) backwards; }
@@ -135,3 +135,12 @@ main#contents { padding-bottom: 80px; }
*, *::before, ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; transition: none !important; }
.chalk span { opacity: .075; }
}
+/* Arabic (contents.js sets <html dir="rtl">): the layout follows through logical properties (border-inline-start, …).
+ Letters join, so no letter spacing; the faces are each system's own, no font file is loaded. A book's own :root
+ theme, after this file, still sets its faces (this rule has the same specificity as :root). */
+:root:where(:lang(ar)) {
+ --ui: "Segoe UI", "SF Arabic", "Geeza Pro", "Noto Sans Arabic", Tahoma, sans-serif;
+ --book: "Noto Naskh Arabic", "Traditional Arabic", "Times New Roman", serif;
+}
+:root:lang(ar) :is(.kicker, .meta, h1, .unit h2 .label) { letter-spacing: 0; }
+[dir="rtl"] .btn.go svg { transform: scaleX(-1); } /* "open" points the way the page reads */
diff --git a/site/little-horse/lib/contents.js b/site/little-horse/lib/contents.js
index 0bacf99..cb2629d 100644
--- a/site/little-horse/lib/contents.js
+++ b/site/little-horse/lib/contents.js
@@ -55,9 +55,28 @@ const Contents = (() => {
refsLead: '授業で引用したすべての著作です。リンクは著作の DOI または図書館の記録を新しいタブで開きます。信頼できるオンライン記録のない著作はリンクなしで載せています。',
refsCount: '授業で引用した著作 {n} 件', refsAllLinked: '、すべて出典へのリンクつき', refsSomeLinked: '、うち {n} 件は出典へのリンクつき',
},
+ // Arabic plurals: one 1, two 2, few 3–10, many 11–99, other 100+. Arrows point the way the page reads (right to left).
+ ar: {
+ open: 'افتح الكتاب', toCover: 'العودة إلى الغلاف', resume: 'تابع · الفصل {n}', unit: 'الوحدة {n}',
+ minutes: { one: 'دقيقة', two: 'دقيقتان', few: '{n} دقائق', many: '{n} دقيقة', other: '{n} دقيقة' },
+ meta: '{chapters}{samples} · {units} · مع الصوت',
+ metaChapters: { one: 'فصل واحد', two: 'فصلان', few: '{n} فصول', many: '{n} فصلاً', other: '{n} فصل' },
+ metaUnits: { one: 'وحدة واحدة', two: 'وحدتان', few: '{n} وحدات', many: '{n} وحدة', other: '{n} وحدة' },
+ metaSamples: { one: ' + فصل تجريبي واحد', two: ' + فصلان تجريبيان', few: ' + {n} فصول تجريبية', many: ' + {n} فصلاً تجريبياً', other: ' + {n} فصل تجريبي' },
+ samples: 'فصول تجريبية بأسلوب آخر',
+ chapterCount: { one: 'فصل واحد', two: 'فصلان', few: '{n} فصول', many: '{n} فصلاً', other: '{n} فصل' }, finished: 'اكتمل {done} من {n}',
+ doneMark: '✓ مكتمل · ', lastMark: ' · آخر ما فُتح',
+ references: 'المراجع', viewAll: 'عرض الكل ←', backToContents: '→ المحتويات',
+ refsLead: 'كل الأعمال المستشهد بها في الدروس. يفتح كل رابط معرّف DOI للعمل أو سجله في المكتبة في علامة تبويب جديدة؛ والأعمال التي ليس لها سجل موثوق على الإنترنت مذكورة دون رابط.',
+ refsCount: { one: 'عمل واحد مستشهد به في الدروس', two: 'عملان مستشهد بهما في الدروس', few: '{n} أعمال مستشهد بها في الدروس',
+ many: '{n} عملاً مستشهداً به في الدروس', other: '{n} عمل مستشهد به في الدروس' },
+ refsAllLinked: '، وكلها مرتبطة بمصادرها', refsSomeLinked: '، منها {n} مرتبطة بمصادرها',
+ },
};
// the same lookup as translate() in engine.js (the two pages never load each other's file): keep them in step
const LANGUAGE = (document.documentElement.lang || 'en').toLowerCase().split('-')[0];
+ // right-to-left interface languages, as RTL_LANGUAGES in engine.js: keep them in step
+ if (!document.documentElement.dir && ['ar'].includes(LANGUAGE)) document.documentElement.dir = 'rtl';
function translate(key, vars = {}) {
const language = TRANSLATIONS[LANGUAGE]?.[key] !== undefined ? LANGUAGE : 'en';
let text = TRANSLATIONS[language][key] ?? key;
diff --git a/site/little-horse/lib/engine.css b/site/little-horse/lib/engine.css
index bf42cc9..7083c22 100644
--- a/site/little-horse/lib/engine.css
+++ b/site/little-horse/lib/engine.css
@@ -49,7 +49,7 @@ button[hidden] { display: none; }
.paused-mark div { padding: 14px 30px; border-radius: 999px; background: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 22px; }
/* Question cards inside the picture. */
-.card { position: absolute; padding: 20px 26px; border-radius: 20px; background: color-mix(in srgb, var(--panel) 97%, transparent); border: 1.5px solid var(--edge); border-left: 7px solid var(--quiz); box-shadow: 0 14px 44px rgba(0, 0, 0, .35); }
+.card { position: absolute; padding: 20px 26px; border-radius: 20px; background: color-mix(in srgb, var(--panel) 97%, transparent); border: 1.5px solid var(--edge); border-inline-start: 7px solid var(--quiz); box-shadow: 0 14px 44px rgba(0, 0, 0, .35); }
.card.band { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "pic head body acts" "pic fb body acts"; column-gap: 28px; align-items: center; align-content: center; min-height: 150px; }
.band .mascot { grid-area: pic; }
.band .head { grid-area: head; align-self: end; }
@@ -73,7 +73,7 @@ button[hidden] { display: none; }
.fb:empty { display: none; }
.fb.ok::before { content: "✓ "; color: var(--good); font-weight: 700; }
.fb.no::before { content: "✗ "; color: var(--bad); font-weight: 700; }
-.fb ul { margin: 6px 0 0; padding-left: 22px; }
+.fb ul { margin: 6px 0 0; padding-inline-start: 22px; }
.side .fb { max-height: 110px; overflow: auto; font-size: 20px; }
.acts { display: flex; gap: 12px; align-items: center; }
.side .acts { margin-top: 16px; }
@@ -94,8 +94,8 @@ button[hidden] { display: none; }
.grid .mark { font-weight: 700; text-align: center; }
.grid .mark.good { color: var(--good); }
.grid .mark.bad { color: var(--bad); }
-.grid .why { grid-column: 1 / -1; font-size: 19px; color: var(--dim); padding-left: 186px; }
-.grid.text .why { padding-left: 0; }
+.grid .why { grid-column: 1 / -1; font-size: 19px; color: var(--dim); padding-inline-start: 186px; }
+.grid.text .why { padding-inline-start: 0; }
.grid .why:empty { display: none; }
.hit { cursor: pointer; }
@@ -106,7 +106,7 @@ button[hidden] { display: none; }
/* Point and read (tapWords): hit boxes over the picture, the word beside a tapped thing, the counter and Continue.
A book can set --word-font for its early-reader letters. */
.tapw .ring { stroke-width: 5; }
-#ui > .card.word { pointer-events: none; padding: 2px 36px 10px; border-left-width: 1.5px; border-radius: 30px; font: 600 96px/1.15 var(--word-font, var(--ui)); white-space: nowrap; animation: word-in .3s cubic-bezier(.3, 1.5, .6, 1); }
+#ui > .card.word { pointer-events: none; padding: 2px 36px 10px; border-inline-start-width: 1.5px; border-radius: 30px; font: 600 96px/1.15 var(--word-font, var(--ui)); white-space: nowrap; animation: word-in .3s cubic-bezier(.3, 1.5, .6, 1); }
@keyframes word-in { from { transform: scale(.6); opacity: 0; } }
.card.words .acts { margin: 0; gap: 18px; }
.card.words .count { font-size: 24px; font-weight: 600; color: var(--dim); }
@@ -160,12 +160,12 @@ button[hidden] { display: none; }
}
@media (pointer: coarse) and (max-width: 700px) { :root.full #frame { top: calc(50% - 55px); } }
-.sound-note { position: absolute; left: 24px; top: 20px; margin: 0; padding: 8px 18px; border-radius: 12px; background: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 19px; }
+.sound-note { position: absolute; inset-inline-start: 24px; top: 20px; margin: 0; padding: 8px 18px; border-radius: 12px; background: color-mix(in srgb, var(--page) 85%, transparent); color: var(--dim); font-size: 19px; }
.sound-note[hidden] { display: none; }
.blanks .brow { padding: 8px 0; border-bottom: 1px solid var(--rule); }
.blanks .brow:last-child { border-bottom: 0; }
.blanks .bline { line-height: 64px; white-space: nowrap; }
-.blanks .mark { display: inline-block; margin-left: 14px; font-weight: 700; }
+.blanks .mark { display: inline-block; margin-inline-start: 14px; font-weight: 700; }
.blanks .mark.good { color: var(--good); animation: pop .35s ease-out; }
.blanks .mark.bad { color: var(--bad); }
.blanks .why { font-size: 19px; color: var(--dim); line-height: 1.35; }
@@ -175,7 +175,7 @@ button[hidden] { display: none; }
.box.good { border-color: var(--good); }
.box.bad { border-color: var(--bad); }
.box:disabled { opacity: 1; }
-kbd { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-left: .5em; border: 1.5px solid currentColor; border-radius: 6px; font: 600 .7em/1.5 var(--ui); text-align: center; vertical-align: .12em; opacity: .6; }
+kbd { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-inline-start: .5em; border: 1.5px solid currentColor; border-radius: 6px; font: 600 .7em/1.5 var(--ui); text-align: center; vertical-align: .12em; opacity: .6; }
.opt kbd { margin: 0 .6em 0 0; }
.keys { margin: 6px 0 0; font-size: 18px; color: var(--dim); }
.keys kbd { margin: 0 .15em; }
@@ -188,7 +188,7 @@ kbd { display: inline-block; min-width: 1.5em; padding: 0 .4em; margin-left: .5e
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
.help-cols:has(> [hidden]) { grid-template-columns: 1fr; }
.help dl { margin: 0; display: grid; grid-template-columns: 150px 1fr; row-gap: 10px; font-size: 22px; }
-.help dt { text-align: right; padding-right: 18px; white-space: nowrap; }
+.help dt { text-align: end; padding-inline-end: 18px; white-space: nowrap; }
.help dt kbd { margin: 0 0 0 .3em; opacity: .9; }
.help dd { margin: 0; color: var(--dim); }
.help-close { margin: 26px 0 0; font-size: 18px; color: var(--dim); }
@@ -222,15 +222,15 @@ svg.m { display: inline-block; overflow: visible; }
.card.screen:not(.sort):not(.fin) { padding-bottom: 130px; }
.card.screen:not(.sort):not(.fin) > .head, .card.screen:not(.sort):not(.fin) > .fb { flex: none; }
.card.screen:not(.sort):not(.fin) > .body { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
-.screen .acts { position: absolute; right: 70px; bottom: 48px; }
+.screen .acts { position: absolute; inset-inline-end: 70px; bottom: 48px; }
.screen .grid .row { grid-template-columns: 200px minmax(0, 1fr) 40px; padding: 9px 0 9px 12px; }
/* a long label (a system of equations) widens the label column for every row instead of running off the card's left */
.screen .grid:not(.text) { display: grid; grid-template-columns: minmax(200px, max-content) minmax(0, 1fr) 40px; }
.screen .grid:not(.text) > .row { grid-column: 1 / -1; grid-template-columns: subgrid; }
.screen .grid.text .row { grid-template-columns: minmax(0, 1fr) auto 40px; }
.screen .grid .opt { font-size: 22px; min-height: 50px; padding: 4px 20px; }
-.screen .grid .why { padding-left: 216px; font-size: 20px; }
-.screen .grid.text .why { padding-left: 0; }
+.screen .grid .why { padding-inline-start: 216px; font-size: 20px; }
+.screen .grid.text .why { padding-inline-start: 0; }
#ui > .screen.sort { pointer-events: none; }
.screen.sort > * { pointer-events: auto; }
.screen.sort .head { position: absolute; right: 34px; top: 40px; width: 330px; }
@@ -273,10 +273,10 @@ a.cite:focus-visible text, a.cite:focus-visible tspan { fill: var(--task); }
a.cite:focus-visible { outline: 3px solid var(--task); outline-offset: 6px; border-radius: 4px; }
#ui a.cite { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#ui a.cite:hover { color: var(--quiz); }
-.fin .srcs { margin: 26px 0 0; max-width: min(1100px, calc(var(--sw, 1600px) - 100px)); font-size: 19px; line-height: 1.45; color: var(--dim); text-align: left; }
+.fin .srcs { margin: 26px 0 0; max-width: min(1100px, calc(var(--sw, 1600px) - 100px)); font-size: 19px; line-height: 1.45; color: var(--dim); text-align: start; }
.fin .srcs h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--quiz); }
.fin .srcs ol { margin: 0; padding-left: 0; list-style: none; max-height: 190px; overflow: auto; }
-.fin .srcs li { padding-left: 2em; text-indent: -2em; margin: 0 0 6px; }
+.fin .srcs li { padding-inline-start: 2em; text-indent: -2em; margin: 0 0 6px; }
.fin .srcs a { color: var(--chalk); text-underline-offset: 3px; }
.fin .srcs a:hover { color: var(--quiz); }
.fin .srcs a:focus-visible { outline: 3px solid var(--task); outline-offset: 2px; }
@@ -295,3 +295,14 @@ a.btn { text-decoration: none; display: inline-block; }
/* An upright stage is seen at about half the scale of a wide one on the same screen: bigger caption text. */
:root[data-stage="portrait"] .step { width: 120px; } /* the 900-wide bar keeps room for the steps */
:root[data-stage="portrait"] .caption { font-size: 38px; bottom: 60px; }
+/* Right-to-left interface text (engine.js sets <html dir="rtl"> for Arabic). Cards, captions, help and the cover read from
+ the right through the logical properties above (border-inline-start, inset-inline-end, …). The stage and the player bar
+ keep their left-to-right geometry, so a drawing's coordinates, the timeline and the ← → keys mean the same in every
+ language (the bar's step label reads "3 / 6 title" as the bar does). Mathematics reads left to right inside Arabic
+ text, as in Arabic school books: an expression (svg.m) and an answer line (.bline: "3 + 4 = [box] ✗") keep their order. */
+[dir="rtl"] :is(#stage, #bar, svg.m, .bline) { direction: ltr; }
+/* Arabic letters join: letter spacing breaks the words apart. The faces are each system's own Arabic UI and book faces;
+ no font file is loaded. A book's own lib/book.css :root still wins (these have no specificity). */
+:where(:root:lang(ar)) { --ui: "Segoe UI", "SF Arabic", "Geeza Pro", "Noto Sans Arabic", Tahoma, sans-serif; }
+:root:lang(ar) :is(.cover-k, .fin .kicker, .fin .srcs h2) { letter-spacing: 0; }
+:root:lang(ar) .cover-t, :root:lang(ar) .fin .prompt { font-family: "Noto Naskh Arabic", "Traditional Arabic", "Times New Roman", serif; }
diff --git a/site/little-horse/lib/engine.js b/site/little-horse/lib/engine.js
index f36ec13..2177807 100644
--- a/site/little-horse/lib/engine.js
+++ b/site/little-horse/lib/engine.js
@@ -161,6 +161,49 @@ const TRANSLATIONS = {
watchAgain: 'もう一度見る', nextChapter: '次の章へ',
wordsHeard: '{k} / {n}', allWordsHeard: 'ぜんぶ見つけたね!',
},
+ // Arabic plurals (Intl.PluralRules 'ar'): one 1, two 2, few 3–10, many 11–99, other 100+ (zero falls back to other).
+ // The timeline keeps its left-to-right geometry in Arabic (see RTL below), so ← stays "previous step".
+ ar: {
+ decimalSign: '.', stageLabel: 'رسوم الدرس المتحركة', stageLabelTitled: 'رسوم الدرس المتحركة: {title}',
+ shortcuts: 'اختصارات لوحة المفاتيح', lesson: 'الدرس', questions: 'الأسئلة',
+ helpPlay: 'تشغيل أو إيقاف مؤقت', helpStep: 'الخطوة السابقة أو التالية', helpStepInQuestion: 'تغيير الخطوة أثناء السؤال', helpRestart: 'البدء من جديد',
+ helpCaptions: 'إظهار الترجمة النصية أو إخفاؤها', helpSpeed: 'أبطأ أو أسرع', helpFullScreen: 'ملء الشاشة', helpList: 'عرض هذه القائمة',
+ helpChoose: 'اختيار إجابة أو دائرة', helpTrueFalse: 'صواب أو خطأ', helpRows: 'التنقل بين الصفوف',
+ helpNumberLine: 'التحرك على خط الأعداد، أو اختيار عدد لتصنيفه', helpEnter: 'تحقّق، ثم تابع',
+ helpShowAnswer: 'عرض الإجابة', helpLeaveBox: 'الخروج من خانة الإجابة', helpClose: 'اضغط {key} للإغلاق.',
+ paused: 'متوقف مؤقتاً. اضغط مفتاح المسافة أو انقر للمتابعة.',
+ soundFailed: 'تعذّر تشغيل الصوت. يستمر الدرس بالنص المعروض على الشاشة.',
+ startLesson: 'ابدأ الدرس', startFilm: 'تشغيل',
+ aboutMinutesFilm: { one: 'نحو دقيقة، مع الصوت.', two: 'نحو دقيقتين، مع الصوت.', few: 'نحو {n} دقائق، مع الصوت.',
+ many: 'نحو {n} دقيقة، مع الصوت.', other: 'نحو {n} دقيقة، مع الصوت.' },
+ coverKeys: 'اضغط {space} للبدء، و{help} للاختصارات.', spaceKey: 'المسافة',
+ chapterNumber: 'الفصل {n}',
+ aboutMinutes: { one: 'نحو دقيقة، مع الصوت وأسئلة قصيرة.', two: 'نحو دقيقتين، مع الصوت وأسئلة قصيرة.',
+ few: 'نحو {n} دقائق، مع الصوت وأسئلة قصيرة.', many: 'نحو {n} دقيقة، مع الصوت وأسئلة قصيرة.', other: 'نحو {n} دقيقة، مع الصوت وأسئلة قصيرة.' },
+ allChapters: 'كل الفصول', playLabel: 'تشغيل أو إيقاف مؤقت (المسافة)', backLabel: 'الخطوة السابقة (السهم الأيسر)', restartLabel: 'إعادة الدرس',
+ checksInLesson: 'الأسئلة القصيرة والتمارين موجودة في الدرس التفاعلي.',
+ volumeLabel: 'ضبط مستوى الصوت', volumeTitle: 'مستوى الصوت (0 = صامت)', volumeSlider: 'مستوى الصوت',
+ helpLabel: 'اختصارات لوحة المفاتيح (?)', speedLabel: 'سرعة التشغيل (< و >)', captionsLabel: 'الترجمة النصية (C)', fullScreenLabel: 'ملء الشاشة', goToStep: 'الانتقال إلى الخطوة {n}: {title}',
+ quickCheck: 'تحقّق سريع', countOf: 'السؤال {k} من {n}', check: 'تحقّق', showAnswer: 'أظهر الإجابة', nextQuestion: 'السؤال التالي', continue: 'تابع',
+ correct: 'صحيح. ', notQuite: 'ليس تماماً. ', answerPrefix: 'الإجابة: ', keysPrefix: 'المفاتيح: ',
+ hintMove: ' للتحرك، ', hintChoose: ' للاختيار', hintChooseOrClickGrid: ' للاختيار، أو انقر على الشبكة', hintMoveAlongLine: ' للتحرك على الخط، ',
+ hintChooseOrClick: ' للاختيار، أو انقر', hintRow: ' للصف، ', hintTypeFraction: 'اكتب أعداداً مثل 3/4 أو −2 1/4، ', hintTypeNumber: 'اكتب العدد، ',
+ hintTypeDecimal: 'اكتب العدد، ', hintNextBox: ' للخانة التالية، ', hintCheck: ' للتحقق، ', hintLeaveBox: ' للخروج من الخانة',
+ hintPickNumber: ' لاختيار عدد، ', hintPickRing: ' لاختيار دائرته',
+ rowsRight: '{r} من {n} صحيحة. صحّح الصفوف المعلّمة بـ ✗ ثم تحقّق مرة أخرى.',
+ choicesShown: 'حُدّدت الخيارات الصحيحة الآن.', numbersShown: 'كُتبت الأعداد الصحيحة.',
+ notPlacedYet: 'لم يوضع {x} بعد.',
+ realRingIsEmpty: '{x}: كل عدد حقيقي إما نسبي أو غير نسبي، لذلك لا توجد أعداد خاصة بهذه المنطقة.',
+ ringsRight: '{r} من {n} في الدائرة الصحيحة.', ringsShown: 'كل عدد الآن في أصغر دائرة تحتويه.',
+ chipPlaced: '{x}، موضوع في {ring}', chipNotPlaced: '{x}، لم يوضع', pointLabel: 'النقطة {v}', answerBox: 'الإجابة',
+ stepsLeftOfZero: { one: 'خطوة واحدة يسار 0', two: 'خطوتان يسار 0', few: '{n} خطوات يسار 0', many: '{n} خطوة يسار 0', other: '{n} خطوة يسار 0' },
+ natural: 'الطبيعية', whole: 'الكلية', integers: 'الصحيحة', rational: 'النسبية', irrational: 'غير النسبية', real: 'الحقيقية', integerColumn: 'صحيح',
+ trueLabel: 'صواب', falseLabel: 'خطأ',
+ chapterComplete: 'اكتمل الفصل {n}', quickChecks: 'الأسئلة القصيرة', chapterPractice: 'تمارين الفصل', sources: 'مصادر هذا الفصل', opensSource: '{label}، يفتح المصدر في علامة تبويب جديدة',
+ firstTryScore: '{name}: {r} من {t} صحيحة من المحاولة الأولى.', notAttempted: '{name}: لم تُحاوَل.',
+ watchAgain: 'شاهد مرة أخرى', nextChapter: 'الفصل التالي',
+ wordsHeard: '{k} / {n}', allWordsHeard: 'وجدتها كلها!',
+ },
};
// <html data-stage="portrait"> turns the stage upright: 900 wide, 1600 tall. Landscape (1600×900) otherwise.
const PORTRAIT = document.documentElement.dataset.stage === 'portrait';
@@ -168,6 +211,11 @@ const SW = PORTRAIT ? 900 : 1600, SH = PORTRAIT ? 1600 : 900;
document.documentElement.style.setProperty('--sw', SW + 'px');
document.documentElement.style.setProperty('--sh', SH + 'px');
const LANGUAGE = (document.documentElement.lang || 'en').toLowerCase().split('-')[0];
+// Interface languages written right to left. Their text reads from the right while the stage and the timeline keep
+// their left-to-right geometry (engine.css), so drawings, seeking and the arrow keys mean the same in every language.
+// A page that sets <html dir> itself keeps it. contents.js has the same list: keep the two in step.
+const RTL_LANGUAGES = ['ar'];
+if (!document.documentElement.dir && RTL_LANGUAGES.includes(LANGUAGE)) document.documentElement.dir = 'rtl';
const pluralRules = {};
// Interface text in LANGUAGE: translate('chapterNumber', { n: 3 }) → 'Chapter 3'. Chapters may use it too, e.g. for practice labels.
// contents.js has its own copy for the contents page: keep the two in step.
@@ -266,11 +314,12 @@ document.body.insertAdjacentHTML('afterbegin', `<div id="frame">
/* ---------- drawing helpers ---------- */
const NS = 'http://www.w3.org/2000/svg';
-const UI = '"Avenir Next","Segoe UI","Helvetica Neue",Arial,sans-serif';
// Book settings (lib/book.css, next to engine.css and imported by it): --math-font for numbers and formulas,
// --progress-key for the localStorage key the cover and chapters share.
const BOOK = getComputedStyle(document.documentElement);
const bookSetting = name => BOOK.getPropertyValue(name).trim().replace(/^(["'])([^"']*)\1$/, '$2'); // unquote a lone string only
+// The interface face, for measuring text on the canvas: engine.css's --ui (an Arabic page has its own), or a book's.
+const UI = bookSetting('--ui').replace(/,\s+/g, ',') || '"Avenir Next","Segoe UI","Helvetica Neue",Arial,sans-serif';
// The board and ink colours come from the palette in engine.css, which lib/book.css may redefine (a light board):
// the picture, the cards and the player bar then agree. The six hues are the chapters' meanings, set in JS.
const COL = { nat: '#f4a48c', whole: '#86c9e8', int: '#f3c95c', rat: '#e8a0c8', irr: '#8fd6b0', real: '#bba8ee',
diff --git a/site/little-horse/lib/units.css b/site/little-horse/lib/units.css
index e9c62cb..014ce88 100644
--- a/site/little-horse/lib/units.css
+++ b/site/little-horse/lib/units.css
@@ -6,7 +6,7 @@
.unit .grid { position: relative; }
.unit::before { content: ""; position: absolute; inset: 0 16px auto; height: 208px; border-radius: 22px; pointer-events: none;
background: radial-gradient(ellipse 46% 90% at 74% 55%, color-mix(in srgb, var(--c) 11%, transparent), transparent 70%); }
-.unit-art { position: absolute; top: 20px; right: 28px; width: min(580px, 56%); height: auto; overflow: visible; pointer-events: none;
+.unit-art { position: absolute; top: 20px; inset-inline-end: 28px; width: min(580px, 56%); height: auto; overflow: visible; pointer-events: none;
color: var(--c); fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: .78; }
.unit-art text { fill: currentColor; stroke: none; font-family: var(--book); font-style: italic; }
.unit-art .a { color: var(--chalk); opacity: .55; }
@@ -66,7 +66,7 @@
.unit-art { will-change: transform; contain: layout style; }
.unit:not(.live) .unit-art, .unit:not(.live) .unit-art * { animation-play-state: paused; }
@media (max-width: 560px) {
- .unit-art { width: calc(100% - 32px); right: 16px; opacity: .32; }
+ .unit-art { width: calc(100% - 32px); inset-inline-end: 16px; opacity: .32; }
.unit h2 { min-height: 0; padding-top: 104px; font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {