Forum Moderators: phranque
Accept-Language header sent by the browser. It should offer a choice of preferred languages with a quotient of preference. For example, mine reads: en-ca,en;q=0.8,fr-ca;q=0.5,fr;q=0.3 Other options include checking the language in the user-agent header, but that's less reliable. I may user a browser with the interface in one language, but have a preference for another. Geo-targetting is possible too, but that doesn't indicate the preferred language, just the language of the region where the person is connecting from.
You should always offer the possibility of switching languages manually - in that case, set a cookie for the chosen language and serve that up as a default for that user.
- John
<?php echo $_SERVER['HTTP_ACCEPT_LANGUAGE'];?>
[edited by: JAB_Creations at 5:41 pm (utc) on Nov. 16, 2007]
in most cases we allow for a url or form parameter to override all.
(e.g., "...&User:LANGUAGE=sa&...")
if you were using perl the HTTP::Negotiate module [search.cpan.org] would be helpful - perhaps php has something similar...
Why not use Google Analytics?