繁体   English   中英

JMSI18nRoutingBundle symfony2创建路由转换

[英]JMSI18nRoutingBundle symfony2 create the routing tranlations

我在symfony2中使用JMSI18nRoutingBundle。

我阅读了所有文档-> http://jmsyst.com/bundles/JMSI18nRoutingBundle

并在我的配置中使用了3.场景:

jms_i18n_routing:
    default_locale: en
    locales: [en, he]
    strategy: custom
    hosts:
        en: example.com
        he: example.co.il
    redirect_to_host: false

我什至尝试使用2。

只会为其他语言的网址添加前缀。

如我所见,我的问题是当我输入网址时:example.co.il

它说它找不到它的路线。 当我添加this->选项时:{i18n:false}

到路线,它可以正常工作(这用于“保持路线未翻译”)

如我所见,这仅意味着“ he”本地的路由根本不存在。

一个想法,我如何实现它?

根据要求,这是我的router:debug->(我添加了一部分,因为它很长)

he_en__RG__site_base_homepage            ANY    ANY    ANY  /
he__RG__site_base_homepage               ANY    ANY    ANY  /
en__RG__site_base_homepage               ANY    ANY    ANY  /
he_en__RG__site_base_about               ANY    ANY    ANY  /about
he__RG__site_base_about                  ANY    ANY    ANY  /about
en__RG__site_base_about                  ANY    ANY    ANY  /about
he_en__RG__site_base_contact             GET    ANY    ANY  /contact
he__RG__site_base_contact                GET    ANY    ANY  /contact
en__RG__site_base_contact                GET    ANY    ANY  /contact
he_en__RG__site_base_contact_verify      POST   ANY    ANY  /contact
he__RG__site_base_contact_verify         POST   ANY    ANY  /contact
en__RG__site_base_contact_verify         POST   ANY    ANY  /contact
he_en__RG__terms_of_use                  ANY    ANY    ANY  /terms
he__RG__terms_of_use                     ANY    ANY    ANY  /terms
en__RG__terms_of_use                     ANY    ANY    ANY  /terms

你有没有尝试过

php bin /控制台翻译:解压缩--enable-extractor = jms_i18n_routing --dir =。/ src --output-dir =。/ app /资源/翻译

在控制台上了吗? 交换“根据您的需求”。 清除缓存后,它对我有用。

请小心使用,因为它删除了我的messages.de.yml文件中的某些翻译。

它在手册中指出:

只要将模式匹配到其他主机的区域设置,就将使用重定向,除非将redirect_to_host设置为false,在这种情况下,将引发ResourceNotFoundException,这通常会导致404错误。

因此,如果将redirect_to_host设置为false,这是正常现象

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM