2016-03-23 379 views
0

嗨我使用FOSUserBundle與SonataUserBundle的路由。哪些是英文的。 我想用法語翻譯它們。FOSUserBundle翻譯路由名稱

我做了修改routing.yml

sonata_user_resetting: 
    resource: "@SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml" 
    prefix: /reset 

sonata_user_profile: 
    resource: "@SonataUserBundle/Resources/config/routing/sonata_profile_1.xml" 
    prefix: /mon-compte 

sonata_user_register: 
    resource: "@SonataUserBundle/Resources/config/routing/sonata_registration_1.xml" 
    prefix: /inscription 

sonata_user_change_password: 
    resource: "@SonataUserBundle/Resources/config/routing/sonata_change_password_1.xml" 
    prefix: /mon-compte 

sonata_user: 
    resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml' 
    prefix: /admin 

sonata_user_admin_security: 
    resource: '@SonataUserBundle/Resources/config/routing/admin_security.xml' 
    prefix: /admin 

sonata_user_admin_resetting: 
    resource: '@SonataUserBundle/Resources/config/routing/sonata_resetting_1.xml' # et non 'admin_resetting.xml' : erreur dans la doc 
    prefix: /admin/reset 

但我不明白,我可以配置/登錄路由。

你有想法嗎?

編輯:

我AppKernel.php

$bundles = array(
      new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 
      new Symfony\Bundle\SecurityBundle\SecurityBundle(), 
      new Symfony\Bundle\TwigBundle\TwigBundle(), 
      new Symfony\Bundle\MonologBundle\MonologBundle(), 
      new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), 
      new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 
      new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 
      new FM\AppBundle\AppBundle(), 
      new FOS\UserBundle\FOSUserBundle(), 
      // These are the other bundles the SonataAdminBundle relies on 
      new Sonata\CoreBundle\SonataCoreBundle(), 
      new Sonata\BlockBundle\SonataBlockBundle(), 
      new Knp\Bundle\MenuBundle\KnpMenuBundle(), 
      // Storage and SonataAdminBundle 
      new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), 
      new Sonata\AdminBundle\SonataAdminBundle(), 
      new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(), 
      new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'), 
      new Application\Sonata\UserBundle\ApplicationSonataUserBundle(), 
     ); 

Application\Sonata\UserBundle\ApplicationSonataUserBundle是我的託管用戶實體的捆綁。

回答

0

登錄路徑在FOS/UserBundle/Resources/config/routing/security.xml中定義。

示例代碼變化:

fos_user_security_login: 
    path:  /yourpath/login 
    defaults: { _controller: FOSUserBundle:Security:login, _method: POST } 

瞭解更多關於此重寫FOSUserBundle路線:http://symfony.com/doc/current/bundles/FOSUserBundle/routing.html

+0

當我創建新的路徑它的工作原理。但是路由登錄仍然可用,即使我使用'login_path:/ my-new-name'在security.yml中更改路由名稱 – Kevin

+0

首先確保您的bundle在FOSUserBundle後初始化(然後它應該覆蓋之前的路由這個同名)。 –

+0

我做到了,我編輯了我的POST。但仍然是同樣的問題。 – Kevin