1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(vmbackups): a schedule run's failure reason in the reader's language

A failed run kept the error as English text and the schedule page passed
the whole sentence to gettext, which found no catalog entry once values
were filled in. The run now keeps the error as messages (text and values),
as jobs do, and the page shows them with the new words filter.
This commit is contained in:
catborise 2026-11-18 14:05:38 +03:00
parent fb6a427a47
commit e1611efd53
7 changed files with 40 additions and 15 deletions

View file

@ -11,6 +11,7 @@ from django.utils.translation import gettext, ngettext, pgettext, pgettext_lazy
from operations.jobs import take_remembered
from operations.models import Operation
from operations.utils import words as _words
register = template.Library()
@ -54,6 +55,12 @@ def state_label(state):
return STATE_LABELS[state]
@register.filter
def words(messages):
"""A job's stored messages (operations.utils.say) in the reader's language."""
return _words(messages)
@register.filter
def duration(start, end):
"""The time from start to end, in seconds under a minute: timesince counts minutes.