API - fix localization

This commit is contained in:
Sam 2020-07-15 10:10:54 +02:00
parent 36ded61e36
commit e386f466ae

View File

@ -153,9 +153,9 @@ def display_readable_file_size(size_in_bytes):
def get_readable_duration(duration, locale='en'):
if locale != 'en':
if locale is not None and locale != 'en':
_t = humanize.i18n.activate(locale) # noqa
readable_duration = humanize.naturaldelta(timedelta(seconds=duration))
if locale != 'en':
if locale is not None and locale != 'en':
humanize.i18n.deactivate()
return readable_duration