Django

Code

Changeset 761

Show
Ignore:
Timestamp:
10/01/05 11:35:20 (3 years ago)
Author:
hugo
Message:

i18n: i18n string resolution now does string interpolation against the context, too

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/i18n/django/core/template.py

    r760 r761  
    419419        current = path[1:-1] 
    420420    elif path.startswith('_(') and path.endswith(')') and path[2] in ("'", '"') and path[-2] == path[2]: 
    421         current = _(path[3:-2]) 
     421        current = _(path[3:-2]) % context 
    422422    else: 
    423423        current = context 
  • django/branches/i18n/tests/othertests/templates.py

    r760 r761  
    245245    # translation of string without i18n tag 
    246246    'i18n11': ('{{ _("blah") }}', {}, "blah"), 
     247 
     248    # translation of string without i18n tag but with interpolation 
     249    'i18n12': ('{{ _("blah%(anton)s") }}', {'anton': 'blubb'}, "blahblubb"), 
    247250} 
    248251