Test button: the result says 'holds 1 documents', because the count has no plural form #10

Closed
opened 2026-10-01 10:48:17 +00:00 by tiagoagueda · 0 comments
Owner

Found on 2026-09-29 in a read-only review of postulo-paperless at 973969bb7, reading every translated string in the store against its catalogues.

The sentence the Test button returns is one fixed string for every count. It is wrong in English for one document, and no language with plural forms can translate it correctly, because the catalogue has a single entry.

  • Where: src/postulo_paperless/store.py:306-309, in test():

    str(_("Reachable. The archive holds %(count)d documents.")) % {"count": count},
    
  • What happens: a person connects a Paperless-ngx archive that holds one document and reads "Reachable. The archive holds 1 documents." In Polish the catalogue's one translation, "Osiągalny. Archiwum zawiera %(count)d dokumentów." (src/postulo_paperless/locale/pl/LC_MESSAGES/django.po:79-80), is the form for five or more and is shown for one and for two to four as well; the same holds for every language whose header declares more than two forms. There is no ngettext anywhere in the package.

  • Why it matters: every user-facing string is meant to be translatable, and this one cannot be. The core's catalogue tool already extracts ngettext (core/messages_tool.py:116) and postulo-messages check verifies that plural forms agree.

  • Fix: ngettext("Reachable. The archive holds %(count)d document.", "Reachable. The archive holds %(count)d documents.", count) % {"count": count}, imported from django.utils.translation; then uv run postulo-messages extract, refill the entry in the working languages, and uv run postulo-messages compile.

Done when

  • A test in tests/test_paperless.py, beside the one at line 260 that expects "Reachable. The archive holds 0 documents.", has the fake archive report one document and expects "Reachable. The archive holds 1 document."; it fails today.
  • The catalogue entry carries a msgid_plural, and tests/test_catalogues.py::test_placeholders_and_plural_forms_agree passes.
Found on 2026-09-29 in a read-only review of postulo-paperless at 973969bb7, reading every translated string in the store against its catalogues. The sentence the *Test* button returns is one fixed string for every count. It is wrong in English for one document, and no language with plural forms can translate it correctly, because the catalogue has a single entry. - **Where:** `src/postulo_paperless/store.py:306-309`, in `test()`: ```python str(_("Reachable. The archive holds %(count)d documents.")) % {"count": count}, ``` - **What happens:** a person connects a Paperless-ngx archive that holds one document and reads "Reachable. The archive holds 1 documents." In Polish the catalogue's one translation, "Osiągalny. Archiwum zawiera %(count)d dokumentów." (`src/postulo_paperless/locale/pl/LC_MESSAGES/django.po:79-80`), is the form for five or more and is shown for one and for two to four as well; the same holds for every language whose header declares more than two forms. There is no `ngettext` anywhere in the package. - **Why it matters:** every user-facing string is meant to be translatable, and this one cannot be. The core's catalogue tool already extracts `ngettext` (`core/messages_tool.py:116`) and `postulo-messages check` verifies that plural forms agree. - **Fix:** `ngettext("Reachable. The archive holds %(count)d document.", "Reachable. The archive holds %(count)d documents.", count) % {"count": count}`, imported from `django.utils.translation`; then `uv run postulo-messages extract`, refill the entry in the working languages, and `uv run postulo-messages compile`. ## Done when - A test in `tests/test_paperless.py`, beside the one at line 260 that expects "Reachable. The archive holds 0 documents.", has the fake archive report one document and expects "Reachable. The archive holds 1 document."; it fails today. - The catalogue entry carries a `msgid_plural`, and `tests/test_catalogues.py::test_placeholders_and_plural_forms_agree` passes.
tiagoagueda added this to the 0.6.0 milestone 2026-10-01 10:48:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo-paperless#10
No description provided.