如何翻译捆绑包上的标签
How to translate labels on a bundle
我用我自己的语言用捆绑字段的翻译制作了自己的文件。它在我的 FOSUserBundle 上工作,我创建了另一个评论包但不在 FOSUserComment 中。它在 Translation 文件夹中。
示例代码:
<button data-url="{{ url("fos_comment_remove_thread_comment", {"id": comment.thread.id, "commentId": comment.id, "value": constant('FOS\CommentBundle\Model\CommentInterface::STATE_DELETED')}) }}" class="fos_comment_comment_remove">
{% trans from 'FOSCommentBundle' %}fos_comment_comment_delete{% endtrans %}
</button>
我可以替换 {% trans from 'FOSCommentBundle' %}fos_comment_comment_delete{% endtrans %}
以使用我的翻译文件吗?
翻译适用于定义的语言,但我复制了一个文件翻译并实现了我的语言,因为捆绑包中不存在。
我不确定你在那里做了什么。你能告诉我你在哪里存储文件以及你给翻译文件起的名字吗?
你也可以使用{{ 'fos_comment_delete'|trans }}
更新你的问题,以便我更新我的答案。
我用我自己的语言用捆绑字段的翻译制作了自己的文件。它在我的 FOSUserBundle 上工作,我创建了另一个评论包但不在 FOSUserComment 中。它在 Translation 文件夹中。
示例代码:
<button data-url="{{ url("fos_comment_remove_thread_comment", {"id": comment.thread.id, "commentId": comment.id, "value": constant('FOS\CommentBundle\Model\CommentInterface::STATE_DELETED')}) }}" class="fos_comment_comment_remove">
{% trans from 'FOSCommentBundle' %}fos_comment_comment_delete{% endtrans %}
</button>
我可以替换 {% trans from 'FOSCommentBundle' %}fos_comment_comment_delete{% endtrans %}
以使用我的翻译文件吗?
翻译适用于定义的语言,但我复制了一个文件翻译并实现了我的语言,因为捆绑包中不存在。
我不确定你在那里做了什么。你能告诉我你在哪里存储文件以及你给翻译文件起的名字吗?
你也可以使用{{ 'fos_comment_delete'|trans }}
更新你的问题,以便我更新我的答案。