我正在使用 Flask、jinja 和 Mustachjs。
为了完成工作,我使用了 {% raw %} 标签。
现在,它是一个多语言应用程序,我使用 Babel。
我能怎么做 :
{% raw %}
<script id="details" type="text/template">
<table class="table" >
<thead>
<tr>
<th>**{{gettext('col1')}}</th>
<th>**{{gettext('col2')}}</th>
<th>**{{gettext('col6')}}</th>
</tr>
</thead>
<tbody>
{{#skyrsla}}
<tr>
<td> {{index}}</td>
<td> {{nafn}}</td>
<td> {{mean_growth_index}}</td>
</tr>
{{/skyrsla}}
</tbody>
</table>
</script>
{% endraw %}
由于是在原始标签之间,所以 Babel 扩展并没有检测到 {{gettext('col1')} 有没有办法改变 Babel 的配置。
我的实际配置如下:
[python: **.py]
[jinja2: **/templates/**.html]
extensions=jinja2.ext.autoescape,jinja2.ext.with_