python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.29k stars 433 forks source link

Support for additional common date formats #1018

Closed jonocodes closed 11 months ago

jonocodes commented 11 months ago

Overview Description

As an example there should be a way to produce a month/day formatted date in accordance with locale.

en = October 12 de = 12. Oktober

Django handles this using additional localized formatters: https://github.com/django/django/blob/main/django/conf/locale/de/formats.py

In this case it would be using the MONTH_DAY_FORMAT, but the other ones would be good as well.

And here is how shuup does it: https://github.com/shuup/shuup/blob/25f78cfe370109b9885b903e503faac295c7b7f2/shuup/utils/dates.py#L41

It supports fewer formats, but does mention following CLDR.

akx commented 11 months ago

Heh, I think I wrote that bit in Shuup back in the day. 😁

Anyway, have you tried format_skeleton with the MMMd skeleton? Does it do what you want?

jonocodes commented 11 months ago

Ah yes, that does what I need. Thanks!