Skip to content

Incorrect plurals in string "%d source files given on command line" #12903

@rffontenelle

Description

@rffontenelle

Describe the bug

self.build(docnames, method='specific',
summary=__('%d source files given on command line') % len(docnames))

The above code assumes the placeholder %d is plural, but it can be singular. This causes a weird rendered sentence of "1 source files...".

Besides, different languages have different plural rules, so the best would be to make this a ngettext / plural-form string so that the translator can translate correctly for number of plurals their language has.

How to Reproduce

  1. Run: sphinx-build -M html . _build any_source_file
  2. See an output like:
...
building [html]: 1 source files given on command line
...

Environment Information

Platform:              linux; (Linux-6.10.10-arch1-1-x86_64-with-glibc2.40)
Python version:        3.12.6 (main, Sep  8 2024, 13:18:56) [GCC 14.2.1 20240805])
Python implementation: CPython
Sphinx version:        8.0.2
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions