views:

145

answers:

2

I'm using this $lang=$_SERVER['HTTP_ACCEPT_LANGUAGE']; to detect the language of the browser. At first, I thought something was wrong with my code. But then I tried this demo, and even if I had my 'display preferred language' as Spanish (es), it displayed the content English (en). Finally, I figured out that it doesn't work in localhost (Using wamp server 2), but it does online.

Any suggestions?

A: 

Try the Quick Locale Switcher Firefox add-on to see if it helps you change your locale in your test environment.

ecounysis
A: 

If the browser doesn't send an Accept-Language: request header, the PHP default is en.

Fix for Firefox: Type about:config in the address bar. Then change the following entries:

general.useragent.locale
intl.accept_languages
stillstanding