Skip to content

format_list ignores contextual conjunctions in Spanish #1503

Backlog

Description

@0718lol

Overview Description

format_list() always uses the default Spanish conjunction in its list pattern. In Spanish, the conjunction depends on how the next item begins.

Steps to Reproduce

from babel.lists import format_list

print(format_list(["España", "Italia"], locale="es"))
print(format_list(["España", "Suiza", "Italia"], locale="es"))
print(format_list(["mañana", "hoy"], style="or", locale="es"))

Actual Results

España y Italia
España, Suiza y Italia
mañana o hoy

Expected Results

España e Italia
España, Suiza e Italia
mañana u hoy

The Spanish contextual rules apply to the two-item and final patterns. For example, the conjunction remains y in agua y hielo. Unicode CLDR list patterns

Reproducibility

Reproduced on Babel 2.19.0 and upstream master at 394f91a with both es and es_ES. Node's Intl.ListFormat with ICU 77.1 produced the expected strings above.

Additional Information

format_list() applies the locale's two-item or final template directly. ICU applies a contextual rule before substituting the items.

Investigation and drafting were done with Codex assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions