【问题标题】:Symfony and Twig - JMS i18n is only extracting from tags but not filterSymfony 和 Twig - JMS i18n 仅从标签中提取而不是过滤
【发布时间】:2015-09-14 14:33:14
【问题描述】:

在 Symfony 网络应用程序中,我安装了 JMS i18n 用于翻译的东西。

如果我像这样使用它

{% trans %}layout.name.default{% endtrans %}

并运行提取脚本,它就像一个魅力。正是我想要的。

不幸的是,我需要在某个时间点将本地化字符串传递给函数(TWIG 中的宏),但它不再起作用了。

{{ _self.menuItem('layout.navigation.home'|trans(), path('foo_homepage')) }}

当我运行导出时

php app/console translation:extract de --config=app --output-format=xliff
php app/console translation:extract en --config=app --output-format=xliff
php app/console translation:extract fr --config=app --output-format=xliff
php app/console translation:extract it --config=app --output-format=xliff

它只是忽略了我的layout.name.home。我怎样才能让 JMS 也清楚地阅读它?

【问题讨论】:

    标签: php symfony internationalization twig twig-extension


    【解决方案1】:

    所以它似乎只是一些缓存版本,它试图从中读取。在使用rm app/cache/* -rf 手动删除缓存并重建翻译文件后,一切都可以正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-15
      • 1970-01-01
      • 1970-01-01
      • 2020-03-30
      • 2021-09-28
      • 1970-01-01
      • 2021-09-28
      • 1970-01-01
      相关资源
      最近更新 更多