Reading pane: chapter and book headings in the module's language, no scroll bar #18
No reviewers
Labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
schaefera/utStudyBIble!18
Loading…
Reference in a new issue
No description provided.
Delete branch "phase1/chapter-headings"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on #17 (base
phase1/core-layout). Merge this intophase1/core-layoutfirst, then #17 intomain. Part of #11.What
Lang): GerSch shows "1. Mose / Kapitel 1", BSB "Genesis / Chapter 1". A book's first chapter also gets the book name in larger type. If there is no table for the module's language (TR grc, OSHB hbo), the phone's languages are used (gettext order: LANGUAGE, then LC_ALL/LC_MESSAGES/LANG, none under C), else English.BibleNames_*.properties(LGPL-2.1+, 61 locales).tools/booknames/generates them from a pinned JSword commit intocore/src/bible/names/books.ini, which has one[locale]section ofGen=Genesislines per language. The words "Chapter"/"Psalm" (de en es fr it nl pt) are in the hand-writtennames/headings.ini; other languages show the number alone. Core embeds both withinclude_str!and reads them in place.core/src/bible/locale.rsparses a conf's BCP 47Langor a phone's POSIX locale once into aLocale(language, region). Section names are matched by parsed value."book\nchapter");qml/components/books.jsis gone. The glue changes a chapter's rows and its entry together, between begin and end.Blast radius
trunk:
core/src/bible*,qt/src/reading_model.rs,qml/pages/ReadingPane.qml.Gate / rollback: no flag. Undo by reverting this merge, or reinstalling the #17 click. No schema or saved-state change: the saved anchor is still ordinal + fraction.
Budgets (docs/07): peak PSS 147565 kB at
37025d4in mem-check (149959 at36ee071, base #17 146382; budget 165000), so within run-to-run noise of ~2 MB. The name tables are ~80 KB of read-only data, paged in only where touched; nothing is parsed at start-up. A module open parses the 61 section headers (twice at most, for the region and the bare language), which is negligible; a heading scans at most 66 lines. Start-up 130 ms (noise range 80–130).Visible change: English names are JSword's ("Revelation of John", not "Revelation"). The old
qsTrbook-name strings are gone; there were no translations yet. A script subtag is now skipped, sozh-Hant-TWfindszh_TW(it used to fall back tozh).Proof
cargo makeat0025b06: fmt, clippy, all tests pass (40 core), coverage 94.78% (floor 93.97%), release, deny, audit.gen.pyregeneratesbooks.inibyte-identical.cargo make app-dockerat37025d4: qmllint, qt clippy, -Werror build, clang-tidy pass; kill -9 restore matches in core and on screen. At36ee071also: mem-check scrolling 68 reports down / 21 up, steps ≤ 8 verses; inactive save 188 ms after the scroll. (Not re-run since: no QML, glue or C++ change.)reader::heads_chapters_in_the_module_language(GerSch → "1. Mose"/"Kapitel 1", "Psalm 23") fails when the reader ignores confLang.names::speaks_the_module_language_else_the_phone_language_else_englishfails without the region fallback (de-CH → de).names::heads_chapters_and_psalmsfails with the Psalm word broken.names::reads_the_phone_languages_as_gettext_doesfails without the C-locale rule, and again whenLocale::parseaccepts one-letter languages (so "C" counts).locale::reads_bcp47_tags_and_posix_locales_alikefails with the script skip disabled (zh-Hant-TW→ "zh", not "zh_TW").names::has_every_book_in_every_language(61 locales × 66 books in order, none empty) fails with "Exod" removed from[af].names::has_both_heading_words_for_languages_with_book_namesfails with frPsalm=removed.names::names_its_sections_by_locale: every section name round-trips throughLocale.reader::reads_kjvnow asserts "Genesis / Chapter 1" and "Chapter 3".36ee071, "Exodus / Chapter 1" was drawn over Exod 1:1; at37025d4it sits in its own space. Confirmed fixed on the device.36ee071): "1. Mose / Kapitel 1", "Kapitel 3" between Gen 2:25 and 3:1. Playwright doesn't apply (native Qt).b846f7f).Span/heading role (no qt test harness in CI); no QML test for the heading height; the number-only heading (e.g. Russian) is unit-tested in core but not on screen; the GerSch screenshot was not re-run after the height fix;gen.py's empty-name check was not run against bad input; the data-file andLocalecommits were not re-installed on the device (same output by the tests). Please look at: GerSch on the device, a book boundary (Mal → Matt), and a module whose language has no table.Review
be765b5…36ee071): reviews 1–4, audits 55 and 55; see the previous trailers. Fixed then: empty LANGUAGE entries, fetch.sh pinned, number-only heading, gettext order as a pure function.b846f7f,37025d4, heading height): no correctness bug; one source for layout numbers, plain-text headings. Audit: 75.f1169a5, books.ini): two low points fixed in5baa837(LF pinned by.gitattributes; gen.py refuses empty names). Audit: 85.d9b1e5f, headings.ini): no defects; nits only (whole-file scan per lookup, as before).Locale): no correctness bugs. Three low notes, none changed:LANG=english) now gives no languages and drops LANGUAGE. Kept: glibc's setlocale fails on an unknown locale, so messages are in C and gettext ignores LANGUAGE too.zh-yue-HK→zh, untested. Kept: no SWORD conf or phone locale uses extlang.0025b06): Review-Confidence 80. Deductions: findings 1 and 2 kept without a test or a run showing the claim (−10, −10). No missed defect found.Confidence by part
core/src/bible/names.rs,locale.rs,names/section.rs,reader.rs,names/*.ini: medium-high. Unit and golden tests, each shown failing under a break; both data files are checked whole by tests. ReadLocale::parseandNames::languages.reading_model.rs(Span, heading role, slide/drop ordering): medium. Reviewed and exercised by mem-check, but no unit test.ReadingPane.qml(section split, heading height,restore/reportTop): medium. Screenshots, the device check and the mem-check restore cover it; no QML test harness.tools/booknames/: high. Reproducible from the pinned commit.Merge with "Create merge commit".
🤖 Generated with Claude Code
Each chapter opens with a heading ("Chapter N", "Psalm N" in Psalms) and each book with its name, as ListView sections on a new "reference" role. The top-verse report looks past a heading to the first verse below; a restore with a fraction lands on the verse, not the heading. The scroll indicator is gone: the list is only the loaded chapters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>@ -0,0 +3,4 @@// The books' names as the reader sees them, by OSIS id (the ids in the// core's references, e.g. "Gen 1"). A book missing here, e.g. from a// versification with the deuterocanon, shows its id.const names = {This likely won't scale very well to multiple languages; what happens when we load the Schlachter Bibel, for example?
Reading pane: chapter and book headings, no scroll barto Reading pane: chapter and book headings in the module's language, no scroll barRe the comment on
qml/components/books.js("what happens when we load the Schlachter Bibel?"): fixed in 91bbc79..36ee071, andbooks.jsis gone.Headings now follow the module's language (its conf
Lang=), in the Rust core:BibleNames_*.properties(61 locales, LGPL-2.1+), generated intocore/src/bible/names/data.rsbytools/booknames/(pinned JSword commit).grc, OSHBhbo) → the phone's language, else English.Tested in core (GerSch golden test plus locale unit tests) and on a headless screenshot; the build is on your phone.
@ -0,0 +12,4 @@/// Per JSword locale, the books' full names in [`BOOKS`] order.pub(super) const NAMES: &[(&str, [&str; 66])] = &[(Is there a way we can keep these strings in a different file type rather than in rust to indicate that it's static data and not actual dynamic code? I want to really keep the code files as code focused as possible.
@ -0,0 +11,4 @@];/// Per JSword locale, the books' full names in [`BOOKS`] order.pub(super) const NAMES: &[(&str, [&str; 66])] = &[A more readable type alias might be helpful here.
Re the two comments on
core/src/bible/names/data.rs, fixed inf1169a5and5baa837.Data file instead of Rust. The names now live in
core/src/bible/names/books.ini, a plain data file with one[locale]section ofOSIS=namelines per language:names.rsembeds it withinclude_str!and reads the strings where they lie, without copying them. A lookup scans at most 66 lines of one section. It uses the same memory as before (~80 KB of read-only data) and does no work at start-up.tools/booknames/gen.pywrites the file, and regenerating it from the pinned JSword commit gives a byte-identical file..gitattributeskeeps it at LF line endings.Type alias. It isn't needed any more:
data.rsis gone, and with it theBOOKSandNAMESconsts and their array type.Namesnow holds just its locale and that locale's section of the file.A new test,
has_every_book_in_every_language, checks that all 61 languages have the 66 books in the same order, with no empty names. It fails if a book is missing.Locale strings, in two commits:
d9b1e5fmoves the chapter words ("Kapitel", "Salmo", …) out of Rust intocore/src/bible/names/headings.ini, read the same way asbooks.inithrough a smallSectiontype.0025b06replaces locale strings with a type.core/src/bible/locale.rsparses a conf'sLang("pt-BR", "de-Latn-DE") or a phone locale ("de_DE.UTF-8@euro") once intoLocale { language, region }, and gives none for C/POSIX.Names::pick(Option<&Locale>, &[Locale])andui_languages() -> Vec<Locale>take values..inisections are found by comparing parsedLocales, sonames.rsno longer splits, trims or replaces "-" with "_". The only locale literal left in production code isFALLBACK = "en". The tests still feed raw tags, since parsing them is what they test.Gate passes (40 core tests, coverage 94.78%); a fresh high review found no bugs; audit 80. PR body updated.