Ticket #5156: django-i18n-for-get_text_list.diff
File django-i18n-for-get_text_list.diff, 1.2 KB (added by , 17 years ago) |
---|
-
django/core/validators.py
272 272 plural = len(words_seen) 273 273 raise ValidationError, ungettext("Watch your mouth! The word %s is not allowed here.", 274 274 "Watch your mouth! The words %s are not allowed here.", plural) % \ 275 get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in words_seen], 'and')275 get_text_list(['"%s%s%s"' % (i[0], '-'*(len(i)-2), i[-1]) for i in words_seen], _('and')) 276 276 277 277 class AlwaysMatchesOtherField(object): 278 278 def __init__(self, other_field_name, error_message=None): -
django/utils/text.py
123 123 return re.sub(r'[^-A-Za-z0-9_.]', '', s) 124 124 get_valid_filename = allow_lazy(get_valid_filename, unicode) 125 125 126 def get_text_list(list_, last_word= u'or'):126 def get_text_list(list_, last_word=_('or')): 127 127 """ 128 128 >>> get_text_list(['a', 'b', 'c', 'd']) 129 129 'a, b, c or d'