chore: production-readiness sweep on the help-popover wave

- Drop unused 'from src.i18n import t' from pages 1-9 (the swap to
  render_tool_header(tool_id) means no page calls t() directly anymore).
  Pages 10, 11 and the underscore-prefixed pages were already clean or
  legitimately use t().

- Rewrite PDF Extractor help_md (en + es). The original prose described
  features the tool does NOT have — template drawing, per-source saved
  templates, automatic reuse. The actual tool is a heuristic batch
  scanner (per its own docstring: "No templates, no per-bank
  configuration"). New copy: scan → uncheck → pick date format → enable
  OCR if needed → download. Spanish version tagged with
  '<!-- TODO: review Spanish -->' since the prose is best-effort.

- Document why both stSidebarNavSectionHeader (legacy, streamlit~=1.35)
  and stNavSectionHeader (current, 1.57) testids appear in the chrome
  CSS — requirements floor is streamlit>=1.35,<2 so dropping the legacy
  selector would silently break the lower bound.

- Pin the t()-returns-key-on-miss contract that render_tool_header's
  fallback path depends on, with a comment at the call site.

- Pin the demo's intentional skip of hide_streamlit_chrome (so the
  +/- sidebar swap JS doesn't ever try to load there) with a load-
  bearing comment in app_demo.py.

- Confirmed i18n parity: every tool id has page_title / page_caption /
  description / name / help_md in BOTH packs; help.button_label and
  help.missing_body in both.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-02 18:07:33 +00:00
parent 4955fb239b
commit ac94208d8f
13 changed files with 28 additions and 12 deletions

View File

@@ -279,7 +279,13 @@ body, .stApp {
with class ``st-emotion-cache-…`` inside ``stSidebarNav`` — class
hashes are unstable across versions, so we lean on the structural
position (the bare span / h2 directly inside the nav list) rather
than emotion classes. */
than emotion classes.
``stSidebarNavSectionHeader`` is the LEGACY testid used by
Streamlit ~1.35; current Streamlit emits ``stNavSectionHeader``
(handled by the dedicated block further down). Both are kept in
the selector list because the requirements floor is
``streamlit>=1.35,<2`` — dropping the legacy testid would break
the visual treatment on the lower bound. */
[data-testid="stSidebarNav"] h2,
[data-testid="stSidebarNav"] h3,
[data-testid="stSidebarNavSeparator"] span,
@@ -316,6 +322,9 @@ body, .stApp {
[data-testid="stSidebarNavItems"] > li {
margin-bottom: 1px !important;
}
/* Legacy testid — kept for streamlit~=1.35 (see note above). The
tighter padding for the current ``stNavSectionHeader`` is set in
the dedicated block further down. */
[data-testid="stSidebarNavSectionHeader"] {
padding-top: 10px !important;
padding-bottom: 2px !important;
@@ -2168,6 +2177,13 @@ def render_tool_header(tool_id: str) -> None:
# button floats above the big title text.
st.write("")
body = _t(f"tools.{tool_id}.help_md")
# ``src.i18n.t`` falls back to returning the lookup key itself
# on miss (see ``_resolve`` → key-as-string fallback). That's
# what we detect here: any tool whose ``help_md`` entry is
# absent from both en + es packs shows the generic missing-body
# string instead of the raw dotted key. Real help_md content
# in the packs starts with ``**When to use**``-style markdown,
# so this prefix check is safe.
if body.startswith("tools."):
body = _t("help.missing_body")
with st.popover(