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

Closed
opened 2026-10-01 06:39:30 +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_dav/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_dav.py switches language with translation.override("fr-fr"), ("pt-pt") and ("en-gb") (lines 692-697). These are the core's own spellings, handed to the core's tool, so they cannot change here before they change there.
  • Not a language tag: PRODID ends in //EN (src/postulo_dav/sync.py:75). That is the language field of a formal public identifier, written in upper case by its own convention, and it stays.
  • Nothing reads or writes a language on a card or an event. src/postulo_dav/text.py writes no LANGUAGE parameter and drops one it reads.

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.
  • Where a language is ever written on a card or an event, it is a BCP 47 tag: the LANGUAGE parameter of RFC 6350 §5.1 and RFC 5545 §3.2.10 takes one. That bears on postulo/postulo-dav#8, #11 and #12, which patch cards, events and tasks instead of rebuilding them and so must keep a LANGUAGE parameter they find; and on postulo/postulo#335, after which the text Postulo writes is in its owner's language and could say so.

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.
  • A LANGUAGE parameter on a card or event made elsewhere survives a push, once those issues land.

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_dav/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_dav.py` switches language with `translation.override("fr-fr")`, `("pt-pt")` and `("en-gb")` (lines 692-697). These are the core's own spellings, handed to the core's tool, so they cannot change here before they change there. - **Not a language tag:** `PRODID` ends in `//EN` (`src/postulo_dav/sync.py:75`). That is the language field of a formal public identifier, written in upper case by its own convention, and it stays. - **Nothing reads or writes a language on a card or an event.** `src/postulo_dav/text.py` writes no `LANGUAGE` parameter and drops one it reads. ## 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. - Where a language is ever written on a card or an event, it is a BCP 47 tag: the `LANGUAGE` parameter of RFC 6350 §5.1 and RFC 5545 §3.2.10 takes one. That bears on postulo/postulo-dav#8, #11 and #12, which patch cards, events and tasks instead of rebuilding them and so must keep a `LANGUAGE` parameter they find; and on postulo/postulo#335, after which the text Postulo writes is in its owner's language and could say so. ## 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. - A `LANGUAGE` parameter on a card or event made elsewhere survives a push, once those issues land. 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-dav#14
No description provided.