【发布时间】:2017-08-02 15:48:46
【问题描述】:
我将 Symfony3 与 Twig 模板和 VueJs 2 一起使用。
我的 symfony 控制器返回一个带有文章组件的 Twig 视图:
{% extends 'base.html.twig' %}
{% block body %}
<Articles></Articles>
{% endblock %}
还有我的 Articles.vue 组件:
<template>
<section class="articleapp">
<header>
<h1>Mes articles</h1>
</header>
<div class="main">
<li class="article" v-for="article in articles">
{{ article.title }}
</li>
</ul>
</div>
</section>
</template>
<script>
export default {
data () {
return {
articles: [{title: "Voici le nom d'un article"}]
}
}
}
</script>
我想用 Sf/Twig i18n 翻译我的标题“Mes articles”,如 {{ "Mes articles"|trans({}, "") }},以受益于翻译目录。
【问题讨论】: