Skip to content

Add Arabic localization for exercise instructions - #82

Open
SMSMy wants to merge 8 commits into
hasaneyldrm:mainfrom
SMSMy:add-arabic-support
Open

SMSMy wants to merge 8 commits into
hasaneyldrm:mainfrom
SMSMy:add-arabic-support

Conversation

@SMSMy

@SMSMy SMSMy commented Aug 25, 2026 •

Copy link
Copy Markdown

Adds Arabic (ar) translations for all exercise instructions.

What's included

  • data/exercises.schema.json: ar added to both languageMap and languageStepsMap.
  • data/exercises.json: every one of the 1,324 exercises now has instructions.ar (full paragraph) and instruction_steps.ar (ordered step list) — 9,034 Arabic texts in total.
  • index.html: embedded EXERCISES regenerated with Arabic; the interactive browser gets an Arabic tab, and Arabic steps render with dir="rtl".
  • README.md: language count updated to 11, Arabic added to every language list.
  • scripts/validate-schema.mjs + .github/workflows/validate.yml: schema validation (ajv, JSON Schema 2020-12) runs automatically on every push/PR.

Verification evidence

  • No English fallbacks: a literal comparison of instructions.ar vs instructions.en and instruction_steps.ar vs instruction_steps.en across all 1,324 exercises returns 0 identical pairs — every Arabic text is a real translation, not a copied fallback.
  • Schema: node scripts/validate-schema.mjs → ✓ valid — 1324 exercises against exercises.schema.json (now enforced by CI).

Translation methodology

  • Initial translation produced with AI assistance, then human-reviewed over three rounds against a unified Arabic style guide (gym-appropriate terminology, direct instructional tone, no literal translations).
  • Automated consistency checks applied to all 9,034 texts (forbidden literal phrases = 0; remaining Latin characters are only equipment attachment names such as D/V/Y).

Notes

  • add_ar_placeholders.mjs (the one-off migration helper) was removed from the PR after review.
  • Media (images/videos) is unchanged — this PR touches texts only.

SMSMy added 5 commits August 25, 2026 02:11
- index.html: regenerate the embedded EXERCISES with Arabic and add the
  Arabic tab to the interactive browser, with RTL direction for Arabic
  steps (dir="rtl" on the instructions list)
- README.md: 11 languages everywhere, Arabic added to every language list
- scripts/validate-schema.mjs + .github/workflows/validate.yml: schema
  validation on every push and pull request (ajv, JSON Schema 2020-12)
- remove add_ar_placeholders.mjs (one-off migration tool) from the PR
- README.md: Arabic row in the field table, JSON sample, Python and
  JavaScript examples, and the TypeScript interface
- index.html + setup.html: SQL generators now export instructions_fr
  and instructions_ar in all four dialects (CREATE TABLE columns,
  INSERT column list and values) — also fixing the pre-existing gap
  that stopped at instructions_ko
- index.html: 11 language tabs scroll horizontally instead of breaking
  the modal, and RTL direction now applies to the whole instructions
  container, not only the steps list
- scripts/validate-schema.mjs: schema validation plus two permanent
  content-integrity checks (no verbatim English fallbacks in
  instructions.ar, no forbidden literal phrases) — enforced by CI
- .github/workflows/validate.yml: ajv pinned to ^8
The 11-tab bar overflows horizontally; with 11 tabs the selected one
(e.g. Arabic) can sit outside the visible area on phones. Center the
active tab after rendering, using a direction-agnostic scroll delta —
Chromium's scrollIntoView({inline:'center'}) misses in RTL containers.

Verified in a headless browser at 390px: after tapping العربية the tab
is fully visible.
@SMSMy

SMSMy commented Aug 25, 2026

Copy link
Copy Markdown
Author

Review feedback addressed + verification summary

All review notes from the discussion have been implemented:

Item Status
No silent English fallbacks — instructions.ar never equals instructions.en ✅ verified across all 1,324 exercises (paragraph and steps compared literally, enforced in CI)
add_ar_placeholders.mjs (one-off migration helper) ✅ removed from the PR
Interactive browser (index.html) — embedded EXERCISES regenerated with Arabic ✅ Arabic tab added, steps render with dir="rtl"
RTL ✅ applies to the whole instructions container, not only the steps list
README.md ✅ 11 languages everywhere (field table, JSON sample, Python/JS examples, TypeScript interface)
SQL generators (index.html, setup.html) ✅ instructions_fr + instructions_ar exported in all four dialects — also fixes the pre-existing gap that stopped at instructions_ko
Language tabs ✅ 11 tabs scroll horizontally (overflow-x: auto) and the active tab is centered into view on mobile (direction-agnostic scroll delta — scrollIntoView({inline:'center'}) misses in RTL containers)
CI ✅ schema validation (ajv ^8) + two permanent content-integrity checks (no verbatim English fallbacks, no forbidden literal phrases) run on every push/PR

Verification

  • node scripts/validate-schema.mjs → ✓ valid + ✓ no English fallbacks + ✓ no forbidden literal phrases + ✓ all checks passed
  • CI on the latest commit: schema — completed/success → https://github.com/SMSMy/exercises-dataset/actions/runs/32899941113/job/97971150221
  • Visual check in a headless browser (desktop 1280px and mobile 390px): grid, modal, 11 language tabs (scroll working, Arabic selected), RTL steps (numbers on the right, text right-aligned), and the LTR revert for other languages — no horizontal overflow on page or modal.

Scope note

data/exercises.json structure and the Arabic translation texts themselves are untouched — this PR only adds integration, docs, and checks around them.

Ready for review; happy to adjust anything.

@SMSMy

SMSMy commented Aug 25, 2026 •

Copy link
Copy Markdown
Author

Latest update on this branch:

  • Narrowed RTL scope: dir="rtl" now applies only to the translated
    text element (the steps list), while the "Instructions" heading and
    the language tab bar stay LTR in every state. Verified across Arabic /
    French / English: tab order stays fixed, and only the text direction
    changes.
  • Note: I noticed Add Arabic (RTL) instructions + RTL handling #81 targets the same goal (adding Arabic support).
    Happy for the maintainer to review both and use whichever fits the
    project better — that call is entirely yours.
  • CI on the latest commit: passing ✅

Before the fix: the tab bar used to flip with the text.
After:

Arabic modal — tabs stay LTR, RTL only on the steps

French modal — same tab order, natural return to LTR

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