Projet

Général

Profil

0001-forms-fix-creation-of-captcha-answer-when-using-tran.patch

Frédéric Péters, 28 mai 2021 10:30

Télécharger (1,89 ko)

Voir les différences:

Subject: [PATCH] forms: fix creation of captcha answer when using translations
 (#54368)

 wcs/qommon/form.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
wcs/qommon/form.py
69 69
from wcs.conditions import Condition, ValidationError
70 70

  
71 71
from ..portfolio import has_portfolio
72
from . import _, force_str, misc, ngettext
72
from . import N_, _, force_str, misc, ngettext
73 73
from .humantime import humanduration2seconds, seconds2humanduration, timewords
74 74
from .misc import HAS_PDFTOPPM, json_loads, strftime
75 75
from .publisher import get_cfg
......
1607 1607
                # don't get twice the same number
1608 1608
                b = random.randint(2, 9)
1609 1609
            if mode == 'arithmetic-simple':
1610
                operator = random.choice([_('plus'), _('minus')])
1610
                operator = random.choice([N_('plus'), N_('minus')])
1611 1611
            else:
1612
                operator = random.choice([_('times'), _('plus'), _('minus')])
1612
                operator = random.choice([N_('times'), N_('plus'), N_('minus')])
1613 1613
            if operator == 'times':
1614 1614
                answer = a * b
1615 1615
            elif operator == 'plus':
......
1621 1621
            self.question = _('What is the result of %(a)d %(op)s %(b)d?') % {
1622 1622
                'a': a,
1623 1623
                'b': b,
1624
                'op': operator,
1624
                'op': _(operator),
1625 1625
            }
1626 1626
            self.hint = kwargs.get('hint')
1627 1627
            if self.hint is None:
1628
-