How to use the timeago.setting function in timeago

To help you get started, we’ve selected a few timeago examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hustcc / timeago / src / timeago / locales / __init__.py View on Github external
def timeago_template(locale, index, ago_in):
    '''
    simple locale implement
    '''
    try:
        LOCALE = __import__('timeago.locales.' + locale)
        LOCALE = locale_module(LOCALE, locale)
    except:
        locale = setting.DEFAULT_LOCALE
        LOCALE = __import__('timeago.locales.' + locale)
        LOCALE = locale_module(LOCALE, locale)

    if isinstance(LOCALE, list):
        return LOCALE[index][ago_in]
    else:
        return LOCALE(index, ago_in)

timeago

A very simple python library, used to format datetime with `*** time ago` statement. eg: "3 hours ago".

MIT
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis

Similar packages