Ticket #4713: __init__.2.diff

File __init__.2.diff, 1.2 KB (added by Indy, 17 years ago)

Updated patch

  • django/template/__init__.py

     
    8989                                          re.escape(VARIABLE_TAG_START), re.escape(VARIABLE_TAG_END),
    9090                                          re.escape(COMMENT_TAG_START), re.escape(COMMENT_TAG_END)))
    9191
     92# matches if the string is marked for translation
     93trans_re = re.compile(r'_\((\'|").*?(\'|")\)')
     94                                         
    9295# global dictionary of libraries that have been loaded using get_library
    9396libraries = {}
    9497# global list of libraries to load by default for a new parser
     
    691694            # we're also dealing with a literal.
    692695            if var[0] in "\"'" and var[0] == var[-1]:
    693696                self.literal = var[1:-1]
    694            
     697            # If it isn't a literal, check if it's marked for translation.
     698            elif trans_re.match(var):
     699                self.literal = _(var[3:-2])
    695700            else:
    696701                # Otherwise we'll set self.lookups so that resolve() knows we're
    697702                # dealing with a bonafide variable
Back to Top