sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.45k stars 2.1k forks source link

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

Open rffontenelle opened 1 week ago

rffontenelle commented 1 week ago

Describe the bug

https://github.com/sphinx-doc/sphinx/blob/76110c3ea05e4eef02bc1689c4b9253aca743392/sphinx/builders/__init__.py#L298-L299

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_sourcefile
  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