Translates invite form values

This commit is contained in:
Mouse Reeve 2021-03-02 09:55:28 -08:00
parent c1e117a9f6
commit 8bb7d5bba0

View file

@ -6,6 +6,7 @@ from django import forms
from django.forms import ModelForm, PasswordInput, widgets from django.forms import ModelForm, PasswordInput, widgets
from django.forms.widgets import Textarea from django.forms.widgets import Textarea
from django.utils import timezone from django.utils import timezone
from django.utils.translation import gettext as _
from bookwyrm import models from bookwyrm import models
@ -181,13 +182,14 @@ class CreateInviteForm(CustomForm):
exclude = ['code', 'user', 'times_used'] exclude = ['code', 'user', 'times_used']
widgets = { widgets = {
'expiry': ExpiryWidget(choices=[ 'expiry': ExpiryWidget(choices=[
('day', 'One Day'), ('day', _('One Day')),
('week', 'One Week'), ('week', _('One Week')),
('month', 'One Month'), ('month', _('One Month')),
('forever', 'Does Not Expire')]), ('forever', _('Does Not Expire'))]),
'use_limit': widgets.Select( 'use_limit': widgets.Select(
choices=[(i, "%d uses" % (i,)) for i in [1, 5, 10, 25, 50, 100]] choices=[(i, _("%(count)d uses" % {'count': i})) \
+ [(None, 'Unlimited')]) for i in [1, 5, 10, 25, 50, 100]]
+ [(None, _('Unlimited'))])
} }
class ShelfForm(CustomForm): class ShelfForm(CustomForm):