Files
pdfcraft/crates/a11y/README.md
513a1ecc3a i18n: let the layers below hand their sentences over, so they can be translated (#478)
* i18n: let the layers below hand their sentences over, so they can be translated

The accessibility findings, the PDF/A problems, the signature details, the
page-range mistakes and the edit labels were English in all ten languages,
because matching their wording from the UI with a tl! literal would break
silently whenever the engine changed it.

So each layer now hands the wording over instead, apart from the document's
own words: a WORDINGS list of every sentence it can say, with holes in it, and
said(&words), which looks the wording up through the closure it is given and
fills the holes in a single pass. in_english changes nothing, for the CLI and
the tests; the UI passes &i18n::words, a catalog lookup. A wording with no
entry comes back as it stands, which is the English, so the nine catalogs this
does not touch read exactly as before.

a11y::report_html takes a language tag and a words closure, so a saved report
reads the way the panel read, down to its lang attribute. print::PrintError
gained a variant per thing a person can be wrong about, with the numbers apart
from the words; faults rather than mistakes keep their own text.

Spanish translates all of it (107 entries). spanish_covers_what_the_engine_says
requires an entry per wording in the eight lists and
spanish_keeps_the_holes_in_what_the_engine_says requires the holes to survive
the translation, so the catalog cannot fall behind the engine unnoticed.

No new tl! literal, so the Chinese, French and Russian UI-literal gates are
unaffected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Sign tests from #1099: compare against the &'static str kinds

* Camera tests: undo returns a Label now

---------

Co-authored-by: Fernando Areán <soporte@codebit.es>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Brandon Thomas <echelon@gmail.com>
2026-10-11 15:45:51 -04:00

1.5 KiB
Raw Permalink Blame History

pdfcraft-a11y

Layer L4: accessibility (execution plan M12.3). Today: the Accessibility Checker's full check.

let report = check(&doc, &Options::default());          // 31 of 32 rules (colour contrast off)
let html = report_html(&report, "file.pdf", "2026-10-02", "en", &in_english);  // or an interface's words
  • 32 rules in 7 categories, as in Acrobat's full check: Document (permission flag, image-only, tagged, reading order, language, title, bookmarks, colour contrast), Page Content (tagged content, tagged annotations, tab order, character encoding, tagged multimedia, and four manual checks), Forms (tagged fields, descriptions), Alternate Text (figures, nested, associated with content, hides annotation, other elements), Tables (rows, cells, headers, regularity with row/column spans, summary), Lists (items, Lbl/LBody) and Headings (nesting).
  • Each result is Passed, Failed (with findings and pages), Needs manual check, or Skipped.
  • Content checks walk the page content streams (and form XObjects) tracking marked content: painting outside MCID-marked or /Artifact content is untagged.
  • Structure checks read the structure tree through the role map; table regularity counts ColSpan/RowSpan attributes.
  • The report is a self-contained HTML page. Fixes that edit the document (language, title, tab order) live in the engine (Document::accessibility_fix).

Not yet: autotagging, the Tags/Order/Content panels, the Reading Order tool (M12.1–M12.2).