Skip to content

Give a locale pack's standard display and sorting forms without writing the format (locales.ES sorting form García López, Juan) #1145

Open

Description

@derek73

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.

Decided (2026-10-28, decisions/vocabulary-model's #754 render-patterns entry):

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.

Activity

  1. added this to the 3.1 milestone on Nov 8, 2026
  2. self-assigned this
    on Nov 8, 2026
  3. added
    design
    rendering
    locale-packs
    on Nov 8, 2026
  4. removed this from the 3.1 milestone on Nov 14, 2026
  5. derek73 commented on Nov 21, 2026

    @derek73
    OwnerAuthor

    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

  6. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

designenhancementlocale-packsrendering

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions