views:

45

answers:

2

Is there any pitfalls or downsides to relying on $_SERVER['HTTP_ACCEPT_LANG'] for language detection?

+2  A: 

I think, this is actually the best way, as long as you enable users to switch the language afterwards and remember their decision (e.g. in a cookie). You also need a fallback for unsupported languages.

nfechner
A: 

It is very common in Europe at least that browsers are configured with English as the native or only language even though the real native language is something different. As long as you make it easy for your users to set (and keep) their preferred language through your site, you should be safe.

Ronny Vindenes
Indeed. In Canada, at least, looking at logs of my own sites, I notice that the _majority_ of users you have French as their preferred language (via an application-implemented language choice) don't have any language other than English set in their browser preferences.
Canoehead