在带有 BeSimpleI18nRoutingBundle 的 Symfony 3.2.6 中,无法在生产模式下生成 i18n 路由
In Symfony 3.2.6 with BeSimpleI18nRoutingBundle, can't generate i18n routes in production mode
我的项目在 Symfony 3.2.6 中,我尝试使用 BeSimpleI18nRoutingBundle 在生产模式下生成 i18n 路由。
在开发模式下,没问题。
但是在生产模式下,生成的路由总是在相同的区域设置(当前)。
(我已经清除了缓存)
我使用这些链接来切换:
<a href="{{ path(app.request.attributes.get('_route'), {'locale': 'fr'}) }}">fr</a>
<a href="{{ path(app.request.attributes.get('_route'), {'locale': 'en'}) }}">en</a>
你有什么想法吗?
提前致谢。
我找到了解决方案。
为了在开发模式下工作,我必须将 "routing_dev.yml" 中的“_main”路由更新为 "type: be_simple_i18n",如下所示:
_main:
resource: routing.yml
type: be_simple_i18n
生产模式的解决方案是在 "config.yml" 中添加相同的行,其中 "routing.yml" 是这样导入的:
framework:
...
router:
resource: "%kernel.root_dir%/config/routing.yml"
type: be_simple_i18n
我的项目在 Symfony 3.2.6 中,我尝试使用 BeSimpleI18nRoutingBundle 在生产模式下生成 i18n 路由。
在开发模式下,没问题。
但是在生产模式下,生成的路由总是在相同的区域设置(当前)。
(我已经清除了缓存)
我使用这些链接来切换:
<a href="{{ path(app.request.attributes.get('_route'), {'locale': 'fr'}) }}">fr</a>
<a href="{{ path(app.request.attributes.get('_route'), {'locale': 'en'}) }}">en</a>
你有什么想法吗?
提前致谢。
我找到了解决方案。
为了在开发模式下工作,我必须将 "routing_dev.yml" 中的“_main”路由更新为 "type: be_simple_i18n",如下所示:
_main:
resource: routing.yml
type: be_simple_i18n
生产模式的解决方案是在 "config.yml" 中添加相同的行,其中 "routing.yml" 是这样导入的:
framework:
...
router:
resource: "%kernel.root_dir%/config/routing.yml"
type: be_simple_i18n