Skip to content

Language module — the settings drawer and dictionary selection — implementation plan

Scope: one settings surface for the language module, and dictionary SELECTION (not only ordering) for every surface that reads definitions. It edits the three configuration rows that already exist — lang_practice_config, lang_reader_config, lang_source_preference — and adds none.

Status: ratified 2026-09-11; S1, S2 and S3 landed. Shape agreed with the maintainer in conversation against the predecessor’s RepetrobesConfigLauncher (one drawer per tool, draft applied on close) and its DictionaryChooser (two boxes: selected and ordered, deselected).

  • Settings are split across three surfaces: practice limits render inline on the practice page (PracticeSettings), reader settings in their own drawer on the reader (ReaderSettingsDrawer), and the dictionary picker at the foot of the dictionary page (SourcePreferencePicker).
  • The picker can only REORDER. orderPresentations (@emergent/domain) deliberately keeps unlisted sources after the listed ones, a recorded divergence from the predecessor, which dropped a provider absent from the ordering. The reason recorded in the code — no ordering is ever complete: a learner with no row, a licence gained since the last save — is answered below by the no-row rule and the available box, not by keeping unlisted sources visible.
  • lang_source_preference already scopes by activity_kind (NULL = the default row) with most-specific-first precedence (resolveSourcePreference); the activity vocabulary is LANG_ACTIVITY_KIND (reading, dictionary, flashcard). Only the default row is written today.
  • A word’s canonical sound is its transliteration (canonicalSounds, 2026-09-11), independent of the learner’s dictionary order.
  • R1 — One drawer. Every language surface — practice, dictionary, reader, lists — carries a gear that opens the same settings drawer, on the section for the surface it was opened from. Sections: Dictionaries, Practice, Reader, Shortcuts. The inline practice block and the reader’s own drawer are replaced by it.
  • R2 — Selected and available. The Dictionaries section is two boxes. The SELECTED box is ordered and is the whole answer: a dictionary in the AVAILABLE box is omitted from definitions on every surface — lookups, the reader’s aids, the practice card’s meaning. A dictionary that becomes accessible after the learner last saved appears in the available box and stays out of their definitions until they select it (the predecessor’s behaviour). The one exception: a person with no saved row sees every accessible dictionary, so nothing is hidden by default. The canonical SOUND is not a definition and ignores selection: a word sounds the same whether or not the transliteration source is selected for reading.
  • R3 — Per activity, one vocabulary. The section edits the default row and, for each of reading, dictionary lookup and practice, offers “same as my default” or its own selected-and-ordered list — the existing activity_kind scoping, nothing new. Content-scoped rows (content_ref) are out of this drawer’s scope and untouched.
  • R4 — Practice section. The fields PracticeSettings has today — new and revision limits, day start, card types, new-card ordering, source lists — move into the drawer unchanged in meaning.
  • R5 — Reader section. The reader drawer’s content — scope, gloss mode, mouseover, rich formatting — becomes a section, keeping its content-or-language scope switch. Opened from the reader it shows the current content’s settings; opened elsewhere it shows the language defaults.
  • R6 — Draft applied on close. Each section is a draft while the drawer is open and is written when it closes (the predecessor’s shouldApplyRepetrobesConfigDraft pattern), so a half-changed limit never reshuffles a running practice session. Nothing is written while typing.
  • R7 — Shortcuts section. A reference table of the surface’s keys (A S D F, S/Space/Enter), read from the same source the hotkey map uses. Display only; no rebinding.
  • R8 — No new dependency, no new table. Move-up, move-down and move-across buttons implement the two boxes; they are keyboard-accessible and announce their action. No drag and drop.
  • S1 — omission. orderPresentations omits unlisted sources when an ordering exists (null and empty orderings unchanged: everything, in lookup order). canonicalSounds is documented as unaffected. Domain tests; ADR-0059 amendment line.
  • S2 — the chooser. The two-box DictionaryChooser in packages/ui (props: accessible sources, selected ids, callbacks; no i18n inside), the per-activity “same as default” model, and the writes to lang_source_preference rows per activity; replaces SourcePreferencePicker in place on the dictionary page until S3 moves it.
  • S3 — the drawer. The shared drawer shell and gear trigger in packages/ui; the four sections in apps/learner-web; the practice block and the reader drawer retired into it; the shortcuts table; copy in packages/i18n (en, zh-Hans).
  • ADR-0059 decision 7 is amended in its consequences: an unlisted source is OMITTED when a preference row exists (R2).