def init():
    """ Initialize the lib

    Function-design use is to be able to test language settings changes
    """

    if settings.USE_L10N:
        locale = settings.LANGUAGE_CODE.replace('-', '_')
        try:
            humanize.i18n.activate(locale)
        except FileNotFoundError:
            pass  # Just let it to the default locale

    HUMANIZE_FUNC_LIST = [
        'naturalday',
        'naturaltime',
        'ordinal',
        'intword',
        'naturaldelta',
        'intcomma',
        'apnumber',
        'fractional',
        'naturalsize',
        'naturaldate'
    ]

    # registers all humanize functions as template tags
    for funcname in HUMANIZE_FUNC_LIST:
        func = getattr(humanize, funcname)
        register.filter(funcname, func, is_safe=True)
def init ( ) : if settings . USE_L10N : locale = settings . LANGUAGE_CODE . replace ( '-' , '_' ) try : humanize . i18n . activate ( locale ) except FileNotFoundError : pass HUMANIZE_FUNC_LIST = [ 'naturalday' , 'naturaltime' , 'ordinal' , 'intword' , 'naturaldelta' , 'intcomma' , 'apnumber' , 'fractional' , 'naturalsize' , 'naturaldate' ] for funcname in HUMANIZE_FUNC_LIST : func = getattr ( humanize , funcname ) register . filter ( funcname , func , is_safe = True )
Initialize the lib

    Function-design use is to be able to test language settings changes