Ticket #719: i18n.diff
File i18n.diff, 1.7 KB (added by , 19 years ago) |
---|
-
store/django/django/templatetags/i18n.py
18 18 context[self.variable] = LANGUAGES 19 19 return '' 20 20 21 class GetCurrentLanguage (Node):21 class GetCurrentLanguageNode(Node): 22 22 23 23 def __init__(self, variable): 24 24 self.variable = variable … … 112 112 args = token.contents.split() 113 113 if len(args) != 3 or args[1] != 'as': 114 114 raise TemplateSyntaxError, "'get_available_languages' requires 'as variable' (got %r)" % args 115 return Get AvailableLanguagesNode(args[2])115 return GetCurrentLanguageNode(args[2]) 116 116 117 117 def do_translate(parser, token): 118 118 """ … … 189 189 singular.append(token) 190 190 else: 191 191 break 192 if countervar and counter: 192 if countervar and counter: 193 193 if token.contents.strip() != 'plural': 194 194 raise TemplateSyntaxError, "'blocktrans' doesn't allow other block tags inside it" % tag 195 195 while parser.tokens: … … 200 200 break 201 201 if token.contents.strip() != 'endblocktrans': 202 202 raise TemplateSyntaxError, "'blocktrans' doesn't allow other block tags (seen %r) inside it" % token.contents 203 203 204 204 return BlockTranslateNode(extra_context, singular, plural, countervar, counter) 205 205 206 206 register_tag('get_available_languages', do_get_available_languages) 207 register_tag('get_cur ent_language', do_get_current_language)207 register_tag('get_current_language', do_get_current_language) 208 208 register_tag('trans', do_translate) 209 209 register_tag('blocktrans', do_block_translate) 210 210