Page 1 of 1
Redirect to page according to user's language
Posted: Thu Feb 28, 2008 3:54 am
by Sindarin
I have two versions of a site (one in English and one in Greek). How can I check if the user's language is Greek and send him to the Greek site instead of the English one?
Re: Redirect to page according to user's language
Posted: Thu Feb 28, 2008 5:43 am
by robble
To be honest I'm not sure theres a completely accurate way. Most (large) international websites display an option of languages to choose from and I guess save this info in a cookie or something similar so the user is not prompted again.
You could find the country of a user (closest thing I guess to finding the language) by using their ip address and checking it against a database. There's a few classes out there which will do it for you.
You could try this one (I haven't used it before though..)
http://www.phpclasses.org/browse/package/2363.html
Re: Redirect to page according to user's language
Posted: Thu Feb 28, 2008 12:04 pm
by Christopher
You may need to do several checks. Take a look at the browser variable in $_SERVER["HTTP_ACCEPT_LANGUAGE"].
Re: Redirect to page according to user's language
Posted: Fri Feb 29, 2008 1:35 am
by Kieran Huggins
arborint++
But always provide the option to switch.