Skip to content

Restore print/PDF output with multi-language support #27

Description

@mairas

Context

mkdocs-print-site-plugin was removed in #26 (Finnish translation pilot). It has no i18n support: it builds a single print page for the default language only, so every translated page would have linked to an English print page under an English tooltip. Removing it was the right call for that PR — the print button lied on Finnish pages.

The removal took a working English feature with it. The site previously published /print_page/ and showed a printer button on every page (docs/overrides/main.html, guarded by page.url_to_print_page). That URL now 404s.

What to figure out

Printing should come back, but only with something that produces a per-language print page. Options worth evaluating:

  • Check whether mkdocs-print-site-plugin has gained i18n support since, or whether mkdocs-static-i18n's multi-build model can be made to drive it once per language.
  • Gate the button by locale as an interim measure — mkdocs-static-i18n injects i18n_page_locale into the template context (plugin.py), so the existing guard in main.html can be narrowed to English. This restores /print_page/ and the English button without lying to Finnish readers. Rejected for now in favour of a proper multi-language solution, but it is cheap if the full fix stalls.
  • A different print/PDF approach entirely (e.g. per-language PDF export in CI).

Decide

Whether /print_page/ returning 404 is acceptable in the meantime, or whether it warrants a redirect until printing returns.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions