mirror of https://github.com/django/django.git
Pluralized translatable strings in password_validation.py
Forward port of 86dc4889f
from master.
This commit is contained in:
parent
8276f6cfa9
commit
5171f56fae
|
@ -4,7 +4,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: Django\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-10-09 17:42+0200\n"
|
||||
"POT-Creation-Date: 2015-10-10 15:10+0200\n"
|
||||
"PO-Revision-Date: 2010-05-13 15:35+0200\n"
|
||||
"Last-Translator: Django team\n"
|
||||
"Language-Team: English <en@li.org>\n"
|
||||
|
@ -262,40 +262,46 @@ msgstr ""
|
|||
msgid "users"
|
||||
msgstr ""
|
||||
|
||||
#: contrib/auth/password_validation.py:100
|
||||
#: contrib/auth/password_validation.py:101
|
||||
#, python-format
|
||||
msgid ""
|
||||
"This password is too short. It must contain at least %(min_length)d "
|
||||
"character."
|
||||
msgid_plural ""
|
||||
"This password is too short. It must contain at least %(min_length)d "
|
||||
"characters."
|
||||
msgstr ""
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: contrib/auth/password_validation.py:106
|
||||
#: contrib/auth/password_validation.py:111
|
||||
#, python-format
|
||||
msgid "Your password must contain at least %(min_length)d characters."
|
||||
msgstr ""
|
||||
msgid "Your password must contain at least %(min_length)d character."
|
||||
msgid_plural "Your password must contain at least %(min_length)d characters."
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: contrib/auth/password_validation.py:139
|
||||
#: contrib/auth/password_validation.py:147
|
||||
#, python-format
|
||||
msgid "The password is too similar to the %(verbose_name)s."
|
||||
msgstr ""
|
||||
|
||||
#: contrib/auth/password_validation.py:145
|
||||
#: contrib/auth/password_validation.py:153
|
||||
msgid "Your password can't be too similar to your other personal information."
|
||||
msgstr ""
|
||||
|
||||
#: contrib/auth/password_validation.py:172
|
||||
#: contrib/auth/password_validation.py:180
|
||||
msgid "This password is too common."
|
||||
msgstr ""
|
||||
|
||||
#: contrib/auth/password_validation.py:177
|
||||
#: contrib/auth/password_validation.py:185
|
||||
msgid "Your password can't be a commonly used password."
|
||||
msgstr ""
|
||||
|
||||
#: contrib/auth/password_validation.py:187
|
||||
#: contrib/auth/password_validation.py:195
|
||||
msgid "This password is entirely numeric."
|
||||
msgstr ""
|
||||
|
||||
#: contrib/auth/password_validation.py:192
|
||||
#: contrib/auth/password_validation.py:200
|
||||
msgid "Your password can't be entirely numeric."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from django.utils.encoding import force_text
|
|||
from django.utils.html import format_html
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils.six import string_types
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext as _, ungettext
|
||||
|
||||
|
||||
@lru_cache.lru_cache(maxsize=None)
|
||||
|
@ -97,13 +97,21 @@ class MinimumLengthValidator(object):
|
|||
def validate(self, password, user=None):
|
||||
if len(password) < self.min_length:
|
||||
raise ValidationError(
|
||||
_("This password is too short. It must contain at least %(min_length)d characters."),
|
||||
ungettext(
|
||||
"This password is too short. It must contain at least %(min_length)d character.",
|
||||
"This password is too short. It must contain at least %(min_length)d characters.",
|
||||
self.min_length
|
||||
),
|
||||
code='password_too_short',
|
||||
params={'min_length': self.min_length},
|
||||
)
|
||||
|
||||
def get_help_text(self):
|
||||
return _("Your password must contain at least %(min_length)d characters.") % {'min_length': self.min_length}
|
||||
return ungettext(
|
||||
"Your password must contain at least %(min_length)d character.",
|
||||
"Your password must contain at least %(min_length)d characters.",
|
||||
self.min_length
|
||||
) % {'min_length': self.min_length}
|
||||
|
||||
|
||||
class UserAttributeSimilarityValidator(object):
|
||||
|
|
Loading…
Reference in New Issue