utnapischtim / babel-edtf

Localization for EDTF (Extended Date Time Format) date strings.

Home Page:https://babel-edtf.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Babel-EDTF

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 – September 2020'

The following formats are supported:

  • short
  • medium
  • long
  • full

About

Localization for EDTF (Extended Date Time Format) date strings.

https://babel-edtf.readthedocs.io

License:MIT License


Languages

Language:Python 96.9%Language:Shell 3.1%