import locale
from datetime import datetime


def pretty_print_timestamp(ts, lang):
    """
    Pretty print of a locale

    :param ts:  Timestamp
    :param lang: ui_locales
    :return: String
    """
    formatter = '%b. %d.'
    if lang == 'de':
        try:
            locale.setlocale(locale.LC_TIME, 'de_DE.UTF-8')
            formatter = '%d. %b.'
        except locale.Error:
            locale.setlocale(locale.LC_TIME, 'en_US.UTF8')

    return datetime.strptime(str(ts), '%Y-%m-%d').strftime(formatter)