fix: use correct singular/plural forms for source file count strings

The build_specific and build_update summary messages used hardcoded plural strings even when the count is 1, producing grammar errors like "1 source files given on command line". This fix uses conditional string selection for correct singular/plural forms.

OPENsphinx-doc/sphinxPR #144562026-05-28
  • The build_specific() method uses a hardcoded plural summary string "%d source files given on command line" even when len(docnames) == 1, producing grammatically incorrect output like "1 source files given on command line".
  • The same issue affects build_update() with "targets for %d source files that are out of date".
  • Issue #12903 reported the bug with a clear reproduction: run sphinx-build with a single source file and see "building [html]: 1 source files given on command line".
  • sphinx/builders/__init__.py: Changed build_specific() summary to use conditional string selection ("%d source file given on command line" for 1, "%d source files given on command line" otherwise).
  • sphinx/builders/__init__.py: Changed build_update() summary similarly ("target for %d source file that is out of date" for 1, "targets for %d source files that are out of date" otherwise).
  • tests/test_application.py: Added test_build_specific_single_file() that verifies the singular form is produced when building one file.
  • Used Sphinx's existing __() translation function for both strings so translators can handle both forms separately.
  • test_build_specific: Verifies multi-file case still produces "3 source files given on command line" - PASSED.
  • test_build_specific_single_file: New test verifying single file produces "1 source file given on command line" - PASSED.
  • Full test_application.py suite: 9/9 tests pass.
  • sphinx/builders/__init__.py
  • tests/test_application.py
  • 2026-05-28T23:44:27Z — Read the Docs build completed successfully for PR #14456. Combined CI status is green (success). Open
  • 2026-06-16T09:38:41Z — Cron check: commit statuses changed. State=open, mergeable_state=blocked.
  • Sphinx's locale system uses _TranslationProxy with gettext only — no ngettext support. Conditional string selection before the __() call is the practical approach.
  • Always check if the locale system supports ngettext before trying to use it. Sphinx's proxy only wraps gettext.
  • The issue was stale (from Sphinx 8.0.2, current is 9.1.0) but still reproducible. Don't assume age = fixed.
  • No overlap — the issue had 0 comments and no linked PRs, making it a clean candidate.
  • Translation .po bugs (like #14347/#14452) are a proven repeatable pattern. Pluralization/inflection bugs in console output are the next tier of high-signal targets.
  • Waiting for maintainer review now that CI is fully green.

More entries