python-babel / babel

The official repository for Babel, the Python Internationalization Library

Home Page:http://babel.pocoo.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] Use standalone month name when month is standalone or give ability to chose

07pepa opened this issue · comments

commented

Overview Description

CLDR is not used correctly. in some langue you call month diferently from when is in a date due declination
when month is standalone name it is not localized into standalone variant.

see https://github.com/unicode-org/cldr/blob/9ffd5f7e749b838c67f5feaf85f67f9d1554303f/common/main/cs.xml#L4072
vs
https://github.com/unicode-org/cldr/blob/9ffd5f7e749b838c67f5feaf85f67f9d1554303f/common/main/cs.xml#L4072

Steps to reproduce

from datetime import date, datetime, time
from babel.dates import format_date, format_datetime, format_time
dt = datetime(2007, 4, 1, 15, 30)
format_datetime(dt, "MMMM", locale="cs")

Actual Results

dubna

Expected Results

duben

Reproducibility

100 %

Additional Information

since month is standalone a standalone context should be used

I think we're using CLDR correctly, using the format-context format for the component when formatting dates. If you can find official CLDR documentation saying that the stand-alone format for a component should be used when there's a single component in the format, I'll stand corrected.

If you need just the name of the month in any given context you like, you can use get_month_names() with e.g. context="stand-alone".

commented

ok that is good enough solution