Follow BCP 47 for language codes: canonical tags in tests and documents, gettext names only for the locale directories #5

Closed
opened 2026-10-01 06:39:31 +00:00 by tiagoagueda · 0 comments
Owner

The requirement: all language codes must follow BCP 47. A BCP 47 tag (RFC 5646) is made of subtags from the IANA registry joined by hyphens, and §2.1.1 gives the form to write one in: the language in lower case, a script in title case, a region in upper case (pt-BR, en-GB, sr-Cyrl). The rule for the whole project is postulo/postulo#337; this is what it means for this plugin.

What exists today

  • Forced by gettext, and staying. The catalogues live in src/postulo_paperless/locale/ under gettext locale names (fr_FR, pt_BR, pt_PT), and each PO file's Language: header says the same. They are not language tags; the core's postulo-messages derives them from a tag with Django's to_locale.
  • The core's lower-case codes, in the tests. tests/test_catalogues.py names the working languages as ("fr-fr", "pt-pt") and the European Union's with "fr-fr" and "pt-pt" among them, and tests/test_paperless.py switches language with translation.override("fr-fr"), ("pt-pt") and ("en-gb") (lines 393-397). These are the core's own spellings, handed to the core's tool, so they cannot change here before they change there.
  • A code the plugin is handed and does not use. The core gives a store DocumentMetadata.language, a free string today. src/postulo_paperless/store.py never reads it, and nothing about a document's language is sent to Paperless.

What the plugin should do

  • Once postulo/postulo#337 lands: move the core pin (the dev group in pyproject.toml pins commit 1d6cdd7e0), and write the codes in the tests as the core then does (fr-FR, pt-PT, en-GB).
  • Say in the README, where it speaks of translations, what a language code is here: a BCP 47 tag in its canonical form, with the locale/ directory names being gettext's and made by the tool.
  • If the document's language is ever sent to Paperless (a tag, a custom field), it is sent as the BCP 47 tag the core hands over, unchanged.

Done when

  • No lower-case regional code is written in this repository, and the only underscore forms are the locale/ directory names and the PO headers.
  • uv run pytest passes against the core that carries postulo/postulo#337, and uv run pytest -m release still holds the European Union catalogues complete.

Requested on 2026-10-01: all language codes must follow BCP 47.

The requirement: **all language codes must follow BCP 47.** A BCP 47 tag (RFC 5646) is made of subtags from the IANA registry joined by hyphens, and §2.1.1 gives the form to write one in: the language in lower case, a script in title case, a region in upper case (`pt-BR`, `en-GB`, `sr-Cyrl`). The rule for the whole project is postulo/postulo#337; this is what it means for this plugin. ## What exists today - **Forced by gettext, and staying.** The catalogues live in `src/postulo_paperless/locale/` under gettext locale names (`fr_FR`, `pt_BR`, `pt_PT`), and each PO file's `Language:` header says the same. They are not language tags; the core's `postulo-messages` derives them from a tag with Django's `to_locale`. - **The core's lower-case codes, in the tests.** `tests/test_catalogues.py` names the working languages as `("fr-fr", "pt-pt")` and the European Union's with `"fr-fr"` and `"pt-pt"` among them, and `tests/test_paperless.py` switches language with `translation.override("fr-fr")`, `("pt-pt")` and `("en-gb")` (lines 393-397). These are the core's own spellings, handed to the core's tool, so they cannot change here before they change there. - **A code the plugin is handed and does not use.** The core gives a store `DocumentMetadata.language`, a free string today. `src/postulo_paperless/store.py` never reads it, and nothing about a document's language is sent to Paperless. ## What the plugin should do - Once postulo/postulo#337 lands: move the core pin (the dev group in `pyproject.toml` pins commit `1d6cdd7e0`), and write the codes in the tests as the core then does (`fr-FR`, `pt-PT`, `en-GB`). - Say in the README, where it speaks of translations, what a language code is here: a BCP 47 tag in its canonical form, with the `locale/` directory names being gettext's and made by the tool. - If the document's language is ever sent to Paperless (a tag, a custom field), it is sent as the BCP 47 tag the core hands over, unchanged. ## Done when - No lower-case regional code is written in this repository, and the only underscore forms are the `locale/` directory names and the PO headers. - `uv run pytest` passes against the core that carries postulo/postulo#337, and `uv run pytest -m release` still holds the European Union catalogues complete. Requested on 2026-10-01: all language codes must follow BCP 47.
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#5
No description provided.