mirror of
https://github.com/django/django.git
synced 2024-12-23 09:36:06 +00:00
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 ""
|
msgstr ""
|
||||||
"Project-Id-Version: Django\n"
|
"Project-Id-Version: Django\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: 2010-05-13 15:35+0200\n"
|
||||||
"Last-Translator: Django team\n"
|
"Last-Translator: Django team\n"
|
||||||
"Language-Team: English <en@li.org>\n"
|
"Language-Team: English <en@li.org>\n"
|
||||||
@ -262,40 +262,46 @@ msgstr ""
|
|||||||
msgid "users"
|
msgid "users"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/auth/password_validation.py:100
|
#: contrib/auth/password_validation.py:101
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid ""
|
msgid ""
|
||||||
"This password is too short. It must contain at least %(min_length)d "
|
"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."
|
"characters."
|
||||||
msgstr ""
|
msgstr[0] ""
|
||||||
|
msgstr[1] ""
|
||||||
|
|
||||||
#: contrib/auth/password_validation.py:106
|
#: contrib/auth/password_validation.py:111
|
||||||
#, python-format
|
#, python-format
|
||||||
msgid "Your password must contain at least %(min_length)d characters."
|
msgid "Your password must contain at least %(min_length)d character."
|
||||||
msgstr ""
|
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
|
#, python-format
|
||||||
msgid "The password is too similar to the %(verbose_name)s."
|
msgid "The password is too similar to the %(verbose_name)s."
|
||||||
msgstr ""
|
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."
|
msgid "Your password can't be too similar to your other personal information."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/auth/password_validation.py:172
|
#: contrib/auth/password_validation.py:180
|
||||||
msgid "This password is too common."
|
msgid "This password is too common."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/auth/password_validation.py:177
|
#: contrib/auth/password_validation.py:185
|
||||||
msgid "Your password can't be a commonly used password."
|
msgid "Your password can't be a commonly used password."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/auth/password_validation.py:187
|
#: contrib/auth/password_validation.py:195
|
||||||
msgid "This password is entirely numeric."
|
msgid "This password is entirely numeric."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: contrib/auth/password_validation.py:192
|
#: contrib/auth/password_validation.py:200
|
||||||
msgid "Your password can't be entirely numeric."
|
msgid "Your password can't be entirely numeric."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ from django.utils.encoding import force_text
|
|||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
from django.utils.six import string_types
|
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)
|
@lru_cache.lru_cache(maxsize=None)
|
||||||
@ -97,13 +97,21 @@ class MinimumLengthValidator(object):
|
|||||||
def validate(self, password, user=None):
|
def validate(self, password, user=None):
|
||||||
if len(password) < self.min_length:
|
if len(password) < self.min_length:
|
||||||
raise ValidationError(
|
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',
|
code='password_too_short',
|
||||||
params={'min_length': self.min_length},
|
params={'min_length': self.min_length},
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_help_text(self):
|
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):
|
class UserAttributeSimilarityValidator(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user