Telephone and address rows: 31 offered languages that have a flag country start with no country #456
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#456
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?
Found on 2026-09-29 in a read-only review of postulo at
95348908d, comparingphones.FROM_LANGUAGEwithlanguages.FLAG_COUNTRIESand the languages offered.Checked again on 2026-10-01 against
mainat0a5cad587: still present. Two of the callers are now ataccounts/forms.py:367andjobs/forms.py:618;core/phones.py,core/languages.pyand the other callers have not moved, and the same 31 codes come out.phones.default_countrypicks the country a new telephone or postal address row starts on, fromFROM_LANGUAGE. That map stops at the European Union languages plus Brazilian Portuguese (25 entries), while Postulo now offers 69 languages andFLAG_COUNTRIESalready names a country for 31 of the missing ones. Somebody reading Postulo in Ukrainian, Turkish, Norwegian, Icelandic, Serbian, Albanian, Georgian, Armenian, Catalan, Welsh, Afrikaans or isiZulu gets a blank country where an EU reader gets a guess.core/phones.py:291(FROM_LANGUAGE) andcore/phones.py:356(default_country);core/languages.py:66(FLAG_COUNTRIES); used byaccounts/forms.py:366,accounts/views.py:70and:85,core/mixins.py:155andjobs/forms.py:621, and through themcore/postal.py:208.af,ak,am,bm,bs,ca,cy,eu,gl,hy,is,ka,kab,lb,mg,mk,nb,nr,ny,rw,sn,so,sq,sr,tr,ts,uk,ve,wo,xhandzu. For them the chooser starts blank; a national number typed without choosing a country goes throughcombineunchanged, is stored as typed, gets nonormalisedvalue and so takes part in no uniqueness check.test_the_two_maps_never_contradict_each_otherintests/test_flags.pysays so), but here they differ for languages that plainly have one, and the test only forbids contradictions, not gaps.FROM_LANGUAGEfor the cases where the telephone answer should differ from the flag, and makedefault_countryfall back tolanguages.flag_country(code), taking the country part of a subdivision (ES-CTtoES,GB-WLStoGB) and keeping it only if it is inphones.BY_CODE. Then the entries inFROM_LANGUAGEthat merely repeat the flag can go.Done when
tests/test_flags.pyasserts that every offered language with a flag country gets a non-emptyphones.default_country, which fails today for the 31 codes above.