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

fix(i18n): form fields shown with their form's label are translated

A sweep of the panel in Turkish found English on screen where a field
had no label of its own: Django makes one from the field's name, and it
is not translated. A host's Hostname (TCP, TLS, socket forms), a new
user's Password, a new volume's Name and Format, and the VM owner form's
User and Instance showed in English, and so did the field names in the
error lists of a refused VM create form ("Hdd size: ...") and of the
new interface, network and pool dialogs ("Ipv4 addr: ..."). These fields
have the label the page shows elsewhere, and "qcow2 (recommended)" and
the navbar button's name are translated. A test checks that every field
these forms show has a label.

Left as they are: VM descriptions, log messages and libvirt's own words
are data; the XML editor's (Ace) screen-reader text is the library's.
This commit is contained in:
catborise 2026-11-21 15:23:33 +03:00
parent 7196871880
commit 85c727d397
15 changed files with 138 additions and 56 deletions

View file

@ -99,6 +99,7 @@ class UserForm(UniqueEmailMixin, forms.ModelForm):
# one choice for is_staff and is_superuser: a superuser keeps the
# is_staff it had (it adds nothing to every permission)
role = forms.ChoiceField(
label=_("Role"),
widget=forms.RadioSelect,
choices=[("user", _("User")), ("template_editor", _("Template editor")), ("superuser", _("Superuser"))],
initial="user",
@ -150,7 +151,7 @@ class UserForm(UniqueEmailMixin, forms.ModelForm):
return permission_rows(self["user_permissions"])
class UserCreateForm(UserForm):
password = forms.CharField(widget=forms.PasswordInput)
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)