Ticket #719: i18n.diff

File i18n.diff, 1.7 KB (added by Nebojša Đorđević - nesh <nesh@…>, 10 years ago)

diff again

  • store/django/django/templatetags/i18n.py

     
    1818        context[self.variable] = LANGUAGES
    1919        return ''
    2020
    21 class GetCurrentLanguage(Node):
     21class GetCurrentLanguageNode(Node):
    2222
    2323    def __init__(self, variable):
    2424        self.variable = variable
     
    112112    args = token.contents.split()
    113113    if len(args) != 3 or args[1] != 'as':
    114114        raise TemplateSyntaxError, "'get_available_languages' requires 'as variable' (got %r)" % args
    115     return GetAvailableLanguagesNode(args[2])
     115    return GetCurrentLanguageNode(args[2])
    116116
    117117def do_translate(parser, token):
    118118    """
     
    189189            singular.append(token)
    190190        else:
    191191            break
    192     if countervar and counter: 
     192    if countervar and counter:
    193193        if token.contents.strip() != 'plural':
    194194            raise TemplateSyntaxError, "'blocktrans' doesn't allow other block tags inside it" % tag
    195195        while parser.tokens:
     
    200200                break
    201201    if token.contents.strip() != 'endblocktrans':
    202202        raise TemplateSyntaxError, "'blocktrans' doesn't allow other block tags (seen %r) inside it" % token.contents
    203    
     203
    204204    return BlockTranslateNode(extra_context, singular, plural, countervar, counter)
    205205
    206206register_tag('get_available_languages', do_get_available_languages)
    207 register_tag('get_curent_language', do_get_current_language)
     207register_tag('get_current_language', do_get_current_language)
    208208register_tag('trans', do_translate)
    209209register_tag('blocktrans', do_block_translate)
    210210
Back to Top