symfony区域设置设置为en_US


symfony Locale being set to en_US

我已经安装了三个区域设置包:

  • JMSi18nRoutingBundle
  • LuneticsLocaleBundle
  • BeSimpleI18nRoutingBundle

我的config.yml是这样的:

jms_i18n_routing:
    default_locale: en
    locales: [en, fr, es]
    strategy: prefix
lunetics_locale:
    strict_mode: false
    allowed_locales: [en, fr, es]
    guessing_order:
        - query
        - router
        - session
        - browser
        - cookie
be_simple_i18n_routing: ~

一切都很顺利,只是我在日志中发现了一个错误:

[2015-08-02 01:16:48] request.CRITICAL: Exception thrown when handling an exception (Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("I18nRoute "site_homepage" (en_US) does not exist.") in "TwigBundle:Exception:error.html.twig" at line 77. at /app/cache/prod/classes.php line 4528) {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template ('"I18nRoute '"site_homepage'" (en_US) does not exist.'") in '"TwigBundle:Exception:error.html.twig'" at line 77. at /app/cache/prod/classes.php:4528, Symfony''Component''Routing''Exception''RouteNotFoundException(code: 0): I18nRoute '"site_homepage'" (en_US) does not exist. at /app/cache/prod/classes.php:14728)"} []

在堆栈中我发现:[2015-08-02 01:16:49] app.INFO: Setting [ en_US ] as locale for the (Sub-)Request [] []但是,我不明白如何将区域设置设置为"en_US"。

我猜它来自LuneticsLocaleBundle的猜测,但是"en_US"应该匹配"en",而不是"en_US"。

我的主要问题是我不知道如何跟踪这个。当我用我自己的设置连接到主页时,首先有"fr_FR",绝对没有问题。

有没有人有测试的想法,我可以运行来解决这个问题?

自从我更新到symfony2.7之后,Lunetics Bundle和JMSi18n之间发生了冲突。

显然这是处理子请求时的一个问题,Lunetics被JMS bundle取代了。

所以我现在只使用JMS进行语言环境检测。它远不如Lunetics干净,但它有效。