def locale_(plugin_id, s):
""" Search the plugin that's rendering the template
for the requested locale """
if plugin_id == 'prism':
ns = prism.settings.PRISM_LOCALE[s]
else:
plugin = prism.get_plugin(plugin_id)
if plugin is None:
logging.output('Unknown plugin ID. Offender: %s' % plugin_id)
return s
ns = plugin.locale[s]
if s == ns:
return s
ns = publish_string(ns, writer=html_fragment_writer).decode('utf-8').rstrip('\r\n')
if '<p>' not in ns:
return ''
ns = ns.split('<p>', 1)[1]
ns = ns[:ns.rfind('</p>')]
return jinja2.Markup(ns)
评论列表
文章目录