From 8bb7d5bba0e1cefa29cfe5b2886d8e394ef5d4dd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Tue, 2 Mar 2021 09:55:28 -0800 Subject: [PATCH] Translates invite form values --- bookwyrm/forms.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index ba2fcc8ca..b920fc9c0 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -6,6 +6,7 @@ from django import forms from django.forms import ModelForm, PasswordInput, widgets from django.forms.widgets import Textarea from django.utils import timezone +from django.utils.translation import gettext as _ from bookwyrm import models @@ -181,13 +182,14 @@ class CreateInviteForm(CustomForm): exclude = ['code', 'user', 'times_used'] widgets = { 'expiry': ExpiryWidget(choices=[ - ('day', 'One Day'), - ('week', 'One Week'), - ('month', 'One Month'), - ('forever', 'Does Not Expire')]), + ('day', _('One Day')), + ('week', _('One Week')), + ('month', _('One Month')), + ('forever', _('Does Not Expire'))]), 'use_limit': widgets.Select( - choices=[(i, "%d uses" % (i,)) for i in [1, 5, 10, 25, 50, 100]] - + [(None, 'Unlimited')]) + choices=[(i, _("%(count)d uses" % {'count': i})) \ + for i in [1, 5, 10, 25, 50, 100]] + + [(None, _('Unlimited'))]) } class ShelfForm(CustomForm):