mirror of https://github.com/django/django.git
fixes #1066 - yesno used the wrong way to do translations
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1673 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2b50cb8c12
commit
3c4c6e0f96
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
from django.core.template import resolve_variable, Library
|
from django.core.template import resolve_variable, Library
|
||||||
from django.conf.settings import DATE_FORMAT, TIME_FORMAT
|
from django.conf.settings import DATE_FORMAT, TIME_FORMAT
|
||||||
|
from django.utils.translation import gettext
|
||||||
import re
|
import re
|
||||||
import random as random_module
|
import random as random_module
|
||||||
|
|
||||||
|
@ -351,7 +352,7 @@ def divisibleby(value, arg):
|
||||||
"Returns true if the value is devisible by the argument"
|
"Returns true if the value is devisible by the argument"
|
||||||
return int(value) % int(arg) == 0
|
return int(value) % int(arg) == 0
|
||||||
|
|
||||||
def yesno(value, arg=_("yes,no,maybe")):
|
def yesno(value, arg=None):
|
||||||
"""
|
"""
|
||||||
Given a string mapping values for true, false and (optionally) None,
|
Given a string mapping values for true, false and (optionally) None,
|
||||||
returns one of those strings accoding to the value:
|
returns one of those strings accoding to the value:
|
||||||
|
@ -365,7 +366,9 @@ def yesno(value, arg=_("yes,no,maybe")):
|
||||||
``None`` ``"yeah,no"`` ``"no"`` (converts None to False
|
``None`` ``"yeah,no"`` ``"no"`` (converts None to False
|
||||||
if no mapping for None is given.
|
if no mapping for None is given.
|
||||||
========== ====================== ==================================
|
========== ====================== ==================================
|
||||||
"""
|
"""
|
||||||
|
if arg is None:
|
||||||
|
arg = gettext('yes,no,maybe')
|
||||||
bits = arg.split(',')
|
bits = arg.split(',')
|
||||||
if len(bits) < 2:
|
if len(bits) < 2:
|
||||||
return value # Invalid arg.
|
return value # Invalid arg.
|
||||||
|
@ -470,4 +473,4 @@ register.filter(urlize)
|
||||||
register.filter(urlizetrunc)
|
register.filter(urlizetrunc)
|
||||||
register.filter(wordcount)
|
register.filter(wordcount)
|
||||||
register.filter(wordwrap)
|
register.filter(wordwrap)
|
||||||
register.filter(yesno)
|
register.filter(yesno)
|
||||||
|
|
Loading…
Reference in New Issue