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

fix(i18n): refusals and checks users read are translated

English-only texts users read, now in their language:
- the serial console's four refusals, which socketiod sends in the
  language LocaleMiddleware would choose (cookie, then browser) and logs
  in English; the texts live in console/refusals.py, as makemessages
  reads only .py files;
- a submission key reused for another request, a malformed MAC address,
  the moved-VM refusal of a script's request, the API's "Templates
  cannot be started" (now the page's sentence), "Pool is not active"
  and the ISO upload's checks;
- "Problem occurred with host" was a fragment with the host's name and
  error after it: one sentence with both.
This commit is contained in:
catborise 2026-11-06 23:16:41 +03:00
parent bf6a0c0a29
commit 0dda091cd5
14 changed files with 187 additions and 41 deletions

View file

@ -5,6 +5,7 @@ from django.contrib.messages import get_messages
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.translation import gettext as _
from instances.jobs import MIGRATE_OPTIONS
from instances.models import Flavor, Instance
from instances.views import (
@ -144,7 +145,7 @@ class InstanceViewSet(viewsets.ViewSet):
if compute_pk is not None and str(queryset.compute_id) != str(compute_pk):
raise Http404()
if queryset.is_template:
return Response({"status": "Templates cannot be started"}, status=status.HTTP_409_CONFLICT)
return Response({"status": _("Templates cannot be started.")}, status=status.HTTP_409_CONFLICT)
return instance_action_response(poweron, request, pk, "poweron command send")
@extend_schema(request=None, responses=ActionStatusSerializer)
@ -162,7 +163,7 @@ class InstanceViewSet(viewsets.ViewSet):
if compute_pk is not None and str(queryset.compute_id) != str(compute_pk):
raise Http404()
if queryset.is_template:
return Response({"status": "Templates cannot be started"}, status=status.HTTP_409_CONFLICT)
return Response({"status": _("Templates cannot be started.")}, status=status.HTTP_409_CONFLICT)
return instance_action_response(powercycle, request, pk, "powercycle command send")
@extend_schema(request=None, responses=ActionStatusSerializer)