现在的位置: 首页 > 综合 > 正文

django国际化——格式化字符串

2013年10月20日 ⁄ 综合 ⁄ 共 233字 ⁄ 字号 评论关闭

The strings you pass to _() or ugettext() can
take placeholders, specified with Python's standard named-string interpolation syntax. Example:

def my_view(request, m, d):
    output = _('Today is %(month)s %(day)s.') % {'month': m, 'day': d}
    return HttpResponse(output)

抱歉!评论已关闭.