I have my site in two languages i.e. English and French, I want that whenever a user visits the site, it must be displayed in the browser's default language. How to do it ?

  • You can do this with Locale. Set your language as default.
    – Nishant
    Nov 4, 2014 at 6:59

2 Answers 2

  1. Goto Admin -> Module -> Locale

  2. Click on Configuration (Locale)

  3. Enable Radio button as per you want to set default language.

  • Then it will be set as default language of my site, but I want that according to browser's default language the display language must change
    – Pooja
    Nov 4, 2014 at 7:05
  • You mean that If browser default language is French then site open in french language ?
    – Nishant
    Nov 4, 2014 at 7:06
  • Yes, Exactly...
    – Pooja
    Nov 4, 2014 at 7:08
  • Have you check the site by changing the browser laguage ?
    – Nishant
    Nov 4, 2014 at 7:33

You could do it something like this:

  • create a module (theme independant) that inserts some javascript into the page

  • using php, insert the current site language into the javascript as a variable

  • check the browser language against the site current language

  • if it matches, nothing happens, if not, create a redirect to mysite.com/fr/ or however you have it setup to differentiate the languages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.