mmattax
mmattax

Reputation: 27700

Is relying on $_SERVER['HTTP_ACCEPT_LANG'] ok for multilingual support?

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

Upvotes: 1

Views: 161

Answers (2)

Ronny Vindenes
Ronny Vindenes

Reputation: 2361

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.

Upvotes: 0

nfechner
nfechner

Reputation: 17525

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.

Upvotes: 2

Related Questions