Skip to content

calendar displays month names in a genitive case for some locales #131146

Open
@plashchynski

Description

@plashchynski

Bug report

Bug description:

A calendar module CLI displays month names in a Polish, and other Slavic languages using the genitive case, as it is used in a phrase "in January". However, for standalone usage, month names should appear in the nominative case to be grammatically correct. For instance, in Polish, "January" should be written as "styczeń" instead of "stycznia"; similarly, in Russian, it should be "январь" rather than "января". This issue likely affects Baltic languages and Greek as well.

Example command demonstrating the issue:

python3 -m calendar --locale pl_PL --encoding utf

This problem occurs because the calendar module uses the strftime %B format specifier, which returns month names suitable for complete date contexts (genitive case). Instead, a nominative form is required when months are mentioned independently:

cpython/Lib/calendar.py

Lines 138 to 140 in 4dcbe06

# Full and abbreviated names of months (1-based arrays!!!)
month_name = _localized_month('%B')
month_abbr = _localized_month('%b')

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Status

    No status

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions