Follow BCP 47 for language codes: canonical tags in tests and documents, and rule files matched as tags #3
Labels
No labels
bug
documentation
enhancement
performance
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo-imap#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
src/postulo_imap/locale/under gettext locale names (fr_FR,pt_BR,pt_PT), and each PO file'sLanguage:header says the same. They are not language tags; the core'spostulo-messagesderives them from a tag with Django'sto_locale.tests/test_catalogues.pynames the working languages as("fr-fr", "pt-pt")and the European Union's with"fr-fr"and"pt-pt"among them, andtests/test_imap.pyswitches language withtranslation.override("fr-fr"),("pt-pt")and("en-gb")(lines 641-646). These are the core's own spellings, handed to the core's tool, so they cannot change here before they change there.src/postulo_imap/rules/<code>.json, each saying"language": "<code>":de,en,es,fr,it,nl,pl,pt. All are valid tags in the right form. They are compared by exact string (dates_inandclassify(only=…)insrc/postulo_imap/classifying.py), andlanguages()offers them "for the connection form", which has no language field yet. The suggestion's context shows the code as it is:rejected (en): ….What the plugin should do
pyproject.tomlpins commit1d6cdd7e0), and write the codes in the tests as the core then does (fr-FR,pt-PT,en-GB).locale/directory names being gettext's and made by the tool.pt-BRorPTchosen on a form or kept on a profile findspt. Today an exact comparison would match nothing, silently.pt, orpt-BRif a variety needs its own phrases), and the test that pins the set checks each name is a canonical tag.Done when
locale/directory names and the PO headers.uv run pytestpasses against the core that carries postulo/postulo#337, anduv run pytest -m releasestill holds the European Union catalogues complete.pt-BRand gets theptrules; a rule file with a name that is not a canonical tag fails the suite.Requested on 2026-10-01: all language codes must follow BCP 47.