Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8196027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:20:31+00:00 2026-06-07T05:20:31+00:00

I have config.yml #Here locale is en translator: { fallback: %locale% } … session:

  • 0

I have

config.yml

#Here locale is en
translator:      { fallback: %locale% }
...
session:
    default_locale: %locale%

routing.yml

AcmeDemoBundle_homepage:
    pattern:  /{_locale}/index
    defaults: { _controller: AcmeDemoBundle:Default:index, _locale: de}
    requirements:
    _locale: en|de

So here by manually typing URL will lead /en/index to English and /de/index to German.

How we can make automatically go to german, if browser Accept language is de_DE or de(German), else go to english(all other browser Accept languages)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:20:33+00:00Added an answer on June 7, 2026 at 5:20 am

    Basically you can do something like that

    $this->get('session')->setLocale(
        $request->getPreferredLanguage(array('en', 'de'))
    );
    

    and its should do the trick. But yeah add it in every action can be hard… that why you can create own kernel event listener.

    Those links can be helpful I think:

    Symfony2 wrong locale detection?

    http://symfony.com/doc/current/cookbook/service_container/event_listener.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a file located at [application]/config/routing.yml, when I change something in there, the
I have a file called config.yml in my /config folder of my rails application.
I have a Symfony2 project with a MySQL db: #app/config/config.yml doctrine: dbal: driver: %database_driver%
I have set up some custom symfony project-level settings in the file config/project.yml following
I have two config-files /app/config/database.yml and /app/config/userconfig.yml i don't want to put the database
this is probably naive question: i have file config.yml which is in .gitignore file
I have this basic code that is failing: ftpconfighash = open(#{RAILS_ROOT}/config/ftp.yml) {|f| YAML.load(f) }
Just wondering if anyone might know what's happening here. I have several schema.yml files,
I have config.php with this... $dbhost = localhost; I want to be able to
I do NOT have config.active_record.whitelist_attributes = true in application config. And I have attr_protected()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.