pology.header

Package pology :: Module header |

# Module header

Header entry in PO catalogs.

Author: Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>

License: GPLv3

Classes
| Header Header entry in PO catalogs.
| TZInfo A simple derived time zone info for use in datetime objects.

Functions
string |
format_datetime(dt=None, wsec=False) Format datetime as found in PO header fields. |
datetime.datetime |
parse_datetime(dstr) Parse formatted datetime from a PO header field into a datetime object. |

Variables
| __package__ = ``'``pology``'``
| x = ``'``^ *(\\d+) *$``'``

Function Details

### format_datetime(dt=None, wsec=False) |
Format datetime as found in PO header fields. If a particular datetime object `dt` is not given, current datetime is used instead. If `wsec` is `False`, the formatted string will not contain the seconds component, which is usual for PO header datetimes. If seconds accuracy is desired, `wsec` can be set to `True`. Parameters: `dt` (datetime.datetime) - datetime `wsec` (bool) - whether to add seconds component Returns: string formatted datetime

### parse_datetime(dstr) |
Parse formatted datetime from a PO header field into a datetime object. The formatted datetime may also have a seconds component, which is typically not present in PO headers. It may also lack a contiguous number of components from the back, e.g. having no time zone offset, or no time at all. Parameters: `dstr` (string) - formatted datetime Returns: datetime.datetime datetime object