Closes #14141: translation cleanup (#14143)

* Translations cleanup

* Tweak variable names; misc string cleanup

* Misc cleanup
This commit is contained in:
Jeremy Stretch
2023-10-30 13:38:03 -04:00
committed by GitHub
parent bbf9018b37
commit 6652555b3c
19 changed files with 12408 additions and 69 deletions

View File

@@ -151,8 +151,12 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
for device in self.cleaned_data.get('devices', []):
if device.site != self.cluster.site:
raise ValidationError({
'devices': _("{} belongs to a different site ({}) than the cluster ({})").format(
device, device.site, self.cluster.site
'devices': _(
"{device} belongs to a different site ({device_site}) than the cluster ({cluster_site})"
).format(
device=device,
device_site=device.site,
cluster_site=self.cluster.site
)
})

View File

@@ -135,10 +135,9 @@ class Cluster(ContactsMixin, PrimaryModel):
# If the Cluster is assigned to a Site, verify that all host Devices belong to that Site.
if self.pk and self.site:
nonsite_devices = Device.objects.filter(cluster=self).exclude(site=self.site).count()
if nonsite_devices:
if nonsite_devices := Device.objects.filter(cluster=self).exclude(site=self.site).count():
raise ValidationError({
'site': _("{} devices are assigned as hosts for this cluster but are not in site {}").format(
nonsite_devices, self.site
)
'site': _(
"{count} devices are assigned as hosts for this cluster but are not in site {site}"
).format(count=nonsite_devices, site=self.site)
})