URL에 URL이 지정되지 않은 경우 자동으로 로컬을 설정하려고합니다. 내가 실현하려면 무엇URL을 실행할 때 symfony2가 기본 언어를 설정합니다.
입니다 : 사용자가 사이트 www.example.com가 자동으로 영어로 설정되어 입력
합니다.
나는이 시도 :# homepage not localized: load the homepage with default language
index_not_localized:
path: /
defaults: { _controller: "AcmeSiteBundle:Default:index", _locale: en }
acme_site:
resource: "@AcmeSiteBundle/Controller/"
type: annotation
prefix: /{_locale}
defaults: { _locale: en }
requirements:
_locale: en|it
을하지만 난 URL에서 언어를 두지 않는 경우 나에게이 오류 제공 :
Unable to generate a URL for the named route "_demo" as such route does not exist.
내가 잘못하고있는 중이 야 무엇을?
질문에 대한 답변은 없지만 [JMSI18nRoutingBundle] (http://jmsyst.com/bundles/JMSI18nRoutingBundle)을 살펴보십시오. 그것은 굉장하고 자동으로 많은 i18n을 해결합니다. :) – althaus
고마워,하지만 모든 것에 번들을 사용할 수는 없다. 이것은 Symfony2의 기능이어야하며 외부 번들 없이도 작동 할 것이다! –