You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Give a locale pack's standard display and sorting forms without writing the format (locales.ES sorting form García López, Juan) #1145
designChanges what the model can express (a shape decision)enhancementlocale-packsLocale packs and language choices (nameparser.locales)renderingrender(), str() and the views (rules/R)
Split out of #754, which closed with this as its one leftover.
The question. A caller who wants a region's standard forms of a name has to know that region's convention and write it as a format spec:
>>>n=parser_for(locales.ES).parse("Juan García López")
>>>n.render("{family}, {given} {middle}")
'García López, Juan'>>>n.render("sorting")
'sorting'
A Locale could carry the forms itself, in the shape of CLDR's person-name patterns (Unicode TR35 part 8): a given-first display pattern, a surname-first display pattern and a sorting pattern.
The shape: named patterns carried on the pack. The RFC's "Render patterns a pack may carry" maps Phase 4's views onto CLDR's fields.
CLDR is where a pattern starts, not its authority. Its pt sorting pattern files under the first surname and drops surname2, which is not ABNT's last-surname entry (decisions/R2).
The feature is additive: str() follows order and reads no pattern, and a pattern is something a caller asks for.
Open, the decision this issue is for: how a call reaches a pattern.ParsedName does not know the locale it was parsed under.
(a) The parse records the convention on the name, as it records order. That costs one more ADDED_IN field, kept out of ==, and a new method or argument to ask for a pattern by. Reusing render()'s argument would change behavior, since render("sorting") returns 'sorting' today. The upside is that a name alone can give its forms.
(b) Pattern rendering goes through the parser (Parser.render(name, "sorting") or the like), as Parser.capitalized does. That needs no field and raises no pickle question, but a name alone cannot give its convention's forms.
Also proposed, not decided: a sorting rendering is a string and sorts by code point. A key method beside comparison_key() could return the convention's fields in sort order, casefolded, for the caller to hand to real collation (ICU, locale.strxfrm).
Not in scope: gender, which decision 9 records only on readings.
Decided 2026-11-20: not planned for now; left open. Nobody outside the project has asked for this, and releases are chosen by how names read for a caller's own population, which this does not change. If you need it, say so here with the data or the use you have: a caller's case is what would move it.
changed the title [-]Should a locale pack give a name's standard display and sorting forms? (`parser_for(locales.ES)` → sorting `García López, Juan` without writing the format)[/-][+]Give a locale pack's standard display and sorting forms without writing the format (`locales.ES` sorting form `García López, Juan`)[/+]on Nov 21, 2026
designChanges what the model can express (a shape decision)enhancementlocale-packsLocale packs and language choices (nameparser.locales)renderingrender(), str() and the views (rules/R)
Activity
derek73 commentedon Nov 21, 2026
Decided 2026-11-20: not planned for now; left open. Nobody outside the project has asked for this, and releases are chosen by how names read for a caller's own population, which this does not change. If you need it, say so here with the data or the use you have: a caller's case is what would move it.
🤖 Generated with Claude Code
[-]Should a locale pack give a name's standard display and sorting forms? (`parser_for(locales.ES)` → sorting `García López, Juan` without writing the format)[/-][+]Give a locale pack's standard display and sorting forms without writing the format (`locales.ES` sorting form `García López, Juan`)[/+]