Skip to content

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

Metadata

Metadata

Assignees

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions