Skip to content

Commit

Permalink
add plural ru locales
Browse files Browse the repository at this point in the history
  • Loading branch information
Telonor authored and Telonor committed Mar 30, 2016
1 parent b3a5583 commit 4f8f264
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 15 deletions.
Binary file modified django_zxcvbn/locale/ru/LC_MESSAGES/django.mo
Binary file not shown.
26 changes: 16 additions & 10 deletions django_zxcvbn/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-03-30 13:17+0300\n"
"POT-Creation-Date: 2016-03-30 15:54+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -19,16 +19,22 @@ msgstr ""
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n"

#: validators.py:23
#, python-format
msgid "Must be %s characters or more"
msgstr "Должен содержать минимум %s символов"
#: validators.py:24
#| msgid "Must be %s characters or more"
msgid "Must be %s character or more"
msgid_plural "Must be %s characters or more"
msgstr[0] "Должен содержать минимум %s символ"
msgstr[1] "Должен содержать минимум %s символа"
msgstr[2] "Должен содержать минимум %s символов"

#: validators.py:27
#, python-format
msgid "Must be %s characters or less"
msgstr "Должен содержать не более %s символов"
#: validators.py:32
#| msgid "Must be %s characters or less"
msgid "Must be %s character or less"
msgid_plural "Must be %s characters or less"
msgstr[0] "Должен содержать не более %s символа"
msgstr[1] "Должен содержать не более %s символов"
msgstr[2] "Должен содержать не более %s символов"

#: validators.py:38
#: validators.py:46
msgid "Password is too weak"
msgstr "Пароль слишком слаб"
18 changes: 13 additions & 5 deletions django_zxcvbn/validators.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _, ungettext_lazy
from django.conf import settings

import zxcvbn
Expand All @@ -20,12 +20,20 @@ def __init__(self, min_length=None, max_length=None):
def __call__(self, value):
if self.min_length and len(value) < self.min_length:
raise ValidationError(
message=_("Must be %s characters or more") % self.min_length,
code=self.code)
message=ungettext_lazy(
"Must be %s character or more",
"Must be %s characters or more"
) % self.min_length,
code=self.code
)
elif self.max_length and len(value) > self.max_length:
raise ValidationError(
message=_("Must be %s characters or less") % self.max_length,
code=self.code)
message=ungettext_lazy(
"Must be %s character or less",
"Must be %s characters or less"
) % self.max_length,
code=self.code
)


class ZXCVBNValidator(object):
Expand Down

0 comments on commit 4f8f264

Please sign in to comment.