Arabic glossary: search without vowel marks, one letter for alef, and letters that work

Merged
LU
12d ago
+39-7

In the Arabic glossary, visitors now find a term by typing it as it is usually typed, without vowel marks. Before, "التشابك" found nothing, because the term is stored as "التَّشابك". The hub search and the "filter terms" box beside each term both ignore vowel marks and the tatweel on both sides now, and they treat an alef with a hamza, madda or wasla (أ إ آ ٱ) as a plain alef. The hamza on ئ and ؤ stays.

The hub's letter bar also had three alef buttons (أ, إ, ا) that all jumped to the first of them. urlize drops the hamza, so their three sections shared one anchor. Arabic now files them under one letter, ا, as its dictionaries do.

The letter bar's Arabic letters also never responded to a search, and never showed which letter was on screen. urlize percent-encoded the letter in the section's id, and the link encoded it a second time, so site.js never found the link for a section. Every letter now gets a plain ASCII anchor: #letter-a for a Latin letter, as before, and #letter-n12 (its position) for any other script. With a search that matches nothing, all 34 Arabic-hub letters now dim and leave the Tab order; before, the 21 Arabic letters stayed active and led to hidden sections. On phones the letter buttons are 44 px, in every glossary language.

Search also counts a final ة as ه and ى as ي, as people often type them.

A letter's heading also no longer lands behind the sticky search and letters. The scroll offset was fixed (150 px on phones, 200 px otherwise), but the toolbar is 218 px tall on a phone, and 223 px on the Arabic hub at 1440 px, where its 34 letters wrap. site.js now sets the offset from the toolbar's actual height, in every glossary language. Checked in Arabic, English and Chinese at 390, 761 and 1440 px: each heading lands 12 px below the toolbar.

Tapping a letter on the Arabic hub, 390 px (before, the heading is under the toolbar)

Before:
before, 390 px

After:
after, 390 px

The same, 1440 px

Before:
before, 1440 px

After:
after, 1440 px

  • assets/js/doors/site.js: one foldTerm for both glossary filters (vowel marks U+064B–U+0652, the dagger alef and the tatweel). Latin accents are left as they were.
  • layouts/glossary/list.html: the Arabic first letter folds أ, إ, آ and ٱ into ا.

At 390 px, the hub, searching "التشابك"

Before:
before, 390 px

After:
after, 390 px

At 1440 px

Before:
before, 1440 px

After:
after, 1440 px

The Arabic hub's letter bar with a search that matches nothing, 390 px (before, the Arabic letters stay active)

Before:
before, 390 px

After:
after, 390 px

The same, 1440 px

Before:
before, 1440 px

After:
after, 1440 px

The letter bar, 390 px

Before:
before, 390 px

After:
after, 390 px

The letter bar, 1440 px

Before:
before, 1440 px

After:
after, 1440 px

The count line in these crops is still English ("of 260 terms 1"); #1159 puts it in Arabic.

Found by the GPT reviewer in the hillclimb round's glossary check (the letter bar's anchors by the Claude reviewer in round 2) (DESIGN.md §4: search on long lists).

Decisions to review

  • Alef variants are one letter, as in Arabic dictionaries. Keeping three letters would need ids that keep the hamza.
  • ة/ه and ى/ي are folded too. They are distinct spellings, but a second reviewer pointed out that visitors often type ه and ي for them; folding only widens a search.
  • Anchors for non-Latin letters are positional (#letter-n12), so they change if a letter is added before them. Latin anchors are unchanged.

Checks

  • python3 scripts/check_seo_html.py <build>: passed.
  • python3 -m unittest discover -s scripts/tests: 145 tests passed.
  • In a browser, on a local build, with no script errors: "التشابك" finds 1 term on the hub (was 0) and 1 in a term page's side card (was 0); "replication" still finds 7. Every letter link resolves to its section.

🤖 Generated with Claude Code