私のウェブサイトの言語を正しく切り替えることができますが、ログインすると現在の言語が失われてしまいます。ログイン前の例http://test.bu/app_dev.php/en/admin/slideshow/とログイン後私はこれを持っていますhttp://test.bu/app_dev.php/fr/admin/slideshow/ symfony2.7は常にロケールを取る:fr。私はFosUserBundleを使用します。私はggogled私はこれを修正するバンドルを使用することができますが、私はconfingurationを編集することでこれを解決することができると思う見つける。 は、ログイン後、私はdefault_target_pathすることで、Webサイトをリダイレクトする:このログイン後とログアウト後に現在のローカル言語が失われた
app_slideshow:
resource: "@AppBundle/Resources/config/routing/slideshow.yml"
prefix: /{_locale}/admin/slideshow
ようslideshow_indexが
this is my config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: fr
framework:
#esi: ~
translator: { fallback: %locale% }
secret: '%secret%'
router:
resource: '%kernel.root_dir%/config/routing.yml'
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: '%locale%'
trusted_hosts: ~
trusted_proxies: ~
session:
# handler_id set to null will use default session handler from php.ini
handler_id: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
host: '%database_host%'
port: '%database_port%'
dbname: '%database_name%'
user: '%database_user%'
password: '%database_password%'
charset: UTF8
# if using pdo_sqlite as your database driver:
# 1. add the path in parameters.yml
# e.g. database_path: '%kernel.root_dir%/data/data.db3'
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
#path: '%database_path%'
orm:
auto_generate_proxy_classes: '%kernel.debug%'
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: '%mailer_transport%'
host: '%mailer_host%'
username: '%mailer_user%'
password: '%mailer_password%'
spool: { type: memory }
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: main
user_class: Gold\UserBundle\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
thanks stackoverflow
私はこの問題をjms routing bundleをインストールすることで解決しました。 – Mz1907
jmsルーティングバンドルのリンクを私に教えてください –
私は2分間あなたに答えを書きます。リンクと設定で – Mz1907