sphinx-doc / sphinx-doc/sphinx

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

Open
#12,903 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

i18n type:bug
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at sphinx/builders/init.py lines 298-299 and reproduce the output with sphinx-build -M html . _build and a single source file. Check how the message is translated and represented in the project's tests or localization workflow. Done means the singular output is grammatically correct and the message supports language-specific plural forms.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.