restore translated strings
This commit is contained in:
parent
3c270d9c12
commit
9317547630
3 changed files with 23 additions and 13 deletions
|
@ -79,7 +79,9 @@ class Organization(ServalaModelMixin, models.Model):
|
||||||
support_message = _(
|
support_message = _(
|
||||||
"Need help? We're happy to help via the <a href='{support_url}'>support form</a>."
|
"Need help? We're happy to help via the <a href='{support_url}'>support form</a>."
|
||||||
).format(support_url=self.urls.support)
|
).format(support_url=self.urls.support)
|
||||||
return mark_safe(f"{message} {support_message}")
|
return mark_safe(
|
||||||
|
f'{message} <i class="bi bi-person-raised-hand"></i> {support_message}'
|
||||||
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
|
|
@ -616,7 +616,9 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
||||||
context=context,
|
context=context,
|
||||||
)
|
)
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
message = "An instance with this name already exists in this organization. Please choose a different name."
|
message = _(
|
||||||
|
"An instance with this name already exists in this organization. Please choose a different name."
|
||||||
|
)
|
||||||
raise ValidationError(organization.add_support_message(message))
|
raise ValidationError(organization.add_support_message(message))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -655,12 +657,12 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
||||||
try:
|
try:
|
||||||
error_body = json.loads(e.body)
|
error_body = json.loads(e.body)
|
||||||
reason = error_body.get("message", str(e))
|
reason = error_body.get("message", str(e))
|
||||||
message = f"Kubernetes API error: {reason}."
|
message = _(f"Kubernetes API error: {reason}.")
|
||||||
raise ValidationError(organization.add_support_message(message))
|
raise ValidationError(organization.add_support_message(message))
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
message = f"Kubernetes API error: {str(e)}."
|
message = _(f"Kubernetes API error: {str(e)}.")
|
||||||
raise ValidationError(organization.add_support_message(message))
|
raise ValidationError(organization.add_support_message(message))
|
||||||
message = f"Error creating instance: {str(e)}."
|
message = _(f"Error creating instance: {str(e)}.")
|
||||||
raise ValidationError(organization.add_support_message(message))
|
raise ValidationError(organization.add_support_message(message))
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
@ -682,18 +684,20 @@ class ServiceInstance(ServalaModelMixin, models.Model):
|
||||||
self.save() # Updates updated_at timestamp
|
self.save() # Updates updated_at timestamp
|
||||||
except ApiException as e:
|
except ApiException as e:
|
||||||
if e.status == 404:
|
if e.status == 404:
|
||||||
message = "Service instance not found in Kubernetes. It may have been deleted externally."
|
message = _(
|
||||||
|
"Service instance not found in Kubernetes. It may have been deleted externally."
|
||||||
|
)
|
||||||
raise ValidationError(self.organization.add_support_message(message))
|
raise ValidationError(self.organization.add_support_message(message))
|
||||||
try:
|
try:
|
||||||
error_body = json.loads(e.body)
|
error_body = json.loads(e.body)
|
||||||
reason = error_body.get("message", str(e))
|
reason = error_body.get("message", str(e))
|
||||||
message = f"Kubernetes API error updating instance: {reason}."
|
message = _(f"Kubernetes API error updating instance: {reason}.")
|
||||||
raise ValidationError(self.organization.add_support_message(message))
|
raise ValidationError(self.organization.add_support_message(message))
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
message = f"Kubernetes API error updating instance: {str(e)}."
|
message = _(f"Kubernetes API error updating instance: {str(e)}.")
|
||||||
raise ValidationError(self.organization.add_support_message(message))
|
raise ValidationError(self.organization.add_support_message(message))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
message = f"Error updating instance: {str(e)}."
|
message = _(f"Error updating instance: {str(e)}.")
|
||||||
raise ValidationError(self.organization.add_support_message(message))
|
raise ValidationError(self.organization.add_support_message(message))
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
|
|
|
@ -146,7 +146,9 @@ class ServiceOfferingDetailView(OrganizationViewMixin, HtmxViewMixin, DetailView
|
||||||
if not form: # Should not happen if context_object is valid, but as a safeguard
|
if not form: # Should not happen if context_object is valid, but as a safeguard
|
||||||
messages.error(
|
messages.error(
|
||||||
self.request,
|
self.request,
|
||||||
self.organization.add_support_message("Could not initialize service form."),
|
self.organization.add_support_message(
|
||||||
|
_("Could not initialize service form.")
|
||||||
|
),
|
||||||
)
|
)
|
||||||
return self.render_to_response(context)
|
return self.render_to_response(context)
|
||||||
|
|
||||||
|
@ -166,7 +168,7 @@ class ServiceOfferingDetailView(OrganizationViewMixin, HtmxViewMixin, DetailView
|
||||||
messages.error(
|
messages.error(
|
||||||
self.request,
|
self.request,
|
||||||
self.organization.add_support_message(
|
self.organization.add_support_message(
|
||||||
f"Error creating instance: {str(e)}."
|
_(f"Error creating instance: {str(e)}.")
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -374,7 +376,7 @@ class ServiceInstanceUpdateView(
|
||||||
messages.error(
|
messages.error(
|
||||||
self.request,
|
self.request,
|
||||||
self.organization.add_support_message(
|
self.organization.add_support_message(
|
||||||
f"Error updating instance: {str(e)}."
|
_(f"Error updating instance: {str(e)}.")
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
return self.form_invalid(form)
|
return self.form_invalid(form)
|
||||||
|
@ -445,7 +447,9 @@ class ServiceInstanceDeleteView(
|
||||||
messages.error(
|
messages.error(
|
||||||
self.request,
|
self.request,
|
||||||
self.organization.add_support_message(
|
self.organization.add_support_message(
|
||||||
f"An error occurred while trying to delete instance '{self.object.name}': {str(e)}."
|
_(
|
||||||
|
f"An error occurred while trying to delete instance '{self.object.name}': {str(e)}."
|
||||||
|
)
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
response = HttpResponse()
|
response = HttpResponse()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue