Localization of Extended Date Time Format level 0 strings.
Project description
A Python module for localization of Extended Date Time Format (EDTF) level 0 strings.
EDTF is a syntax for specifying imprecise dates. See http://www.loc.gov/standards/datetime/. This modules relies on python-edtf for EDTF parsing.
Install
Babel-EDTF is on PyPI so all you need is:
$ pip install babel-edtf
Quickstart
Let’s format some EDTF strings:
>>> from babel_edtf import format_edtf >>> format_edtf('2020-01', locale='en') 'Jan 2020'
>>> format_edtf('2020-01/2020-09', locale='da') 'jan.–sep. 2020'
>>> format_edtf('2020-01/2020-09', format='long', locale='en') 'January\u2009–\u2009September 2020'
The following formats are supported:
short
medium
long
full
Changes
Version 1.2.1 (released 2024-11-07)
fix: consider DD_MM_YYYY invalid
Version 1.2.0 (released 2024-10-28)
setup: upgrade edtf to 5.0.0 and fix bug with dates and times with hour 23
Version 1.1.4 (released 2024-03-05)
fix: fail parsing 29th of February on non-leap years
Version 1.1.3 (released 2023-11-01)
global: use custom parse_edtf in parse_edtf_level0
Version 1.1.2 (released 2023-10-19)
add leading zeros for precise month and day
Version 1.1.1 (released 2023-10-19)
convert isoparse values to string
Version 1.1.0 (released 2023-10-19)
Add parse_edtf isoparse backed method
Version 1.0.0 (released 2020-11-06)
Initial public release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file babel-edtf-1.2.1.tar.gz
.
File metadata
- Download URL: babel-edtf-1.2.1.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ed0c454e123ed7579510d9531eae5af4399272b0dff897d3d42f68e9bed8d8e |
|
MD5 | d4779c45d240b7243ec14db1eedf9d4e |
|
BLAKE2b-256 | f925b2ca3f471b91d37f59ec4304b5f98bdb6001e174a431dda34cf98b2a217c |
File details
Details for the file babel_edtf-1.2.1-py2.py3-none-any.whl
.
File metadata
- Download URL: babel_edtf-1.2.1-py2.py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 706529185b335f05ca4567c468f4ec307ad36fa9ce13b63671f1e113a57f7d55 |
|
MD5 | b503b93f692edd5d1a6fd8fa77d890f1 |
|
BLAKE2b-256 | 0df510fe146e609bcae84bfd32384c3e7ed837cf038c1306a7a72b11eeb165cf |