Follow BCP 47 for language codes: tags in the code and the tests, folder names only where the browser demands them #12
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-chromium#12
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 the extension, whose source this repository holds for both browsers.What exists today
languageTagis a tag in the right form (pt-BR,pt-PT,nb,fr). It is what the pages put in<html lang>(src/lib/i18n.js:23), what dates are formatted with on the list page (Intl.DateTimeFormat(t("languageTag")),src/captures.js:177), and what the downloadable log's header says (src/options.js:48).src/_locales/are named the way the WebExtension format demands, with an underscore:pt_BR,pt_PT.default_localein the manifest names a folder. These stay.Where it does not follow
OFFEREDintest/i18n.test.mjslists"pt_BR"and"pt_PT", and the check that a catalogue names its own language isfolder.replace("_", "-"): it swaps one character and checks neither case nor validity.toLocaleDateString()with no locale (src/popup.js:204), so it follows the browser, not the catalogue in use. postulo/postulo-chromium#11 names the same line.fr_FR,en_GB,test/i18n.test.mjs:11).frandenwhere the core saysfr-franden-gb(fr-FRanden-GBonce postulo/postulo#337 lands). Both are valid; the mapping is written nowhere but that comment.What the extension should do
languageTagis canonical, for instanceIntl.getCanonicalLocales(tag)[0] === tag, and that the folder is the one derived from it.langattribute uses the tag of the catalogue in use.Accept-Languageheader if that issue adds one.Decisions
sr. If postulo/postulo#337 settles onsr-Cyrl,languageTagcan say so while the folder stayssr, the name browsers match. Recommended: follow the core.frorfr-FR. Recommended: keepfranden: a browser set to any French matches thefrfolder, and the tag should name the catalogue actually served.postulo-firefox needs no change: it holds no language code and takes this through its pin. No new on-screen sentence is expected; if one appears,
test/i18n.test.mjsrequires it in all 40_localesat once.Done when
npm testfails on alanguageTagthat is not a canonical BCP 47 tag, and on a folder whose name is not derived from its tag.Requested on 2026-10-01: all language codes must follow BCP 47.