Redirect to page according to user's language
Moderator: General Moderators
Redirect to page according to user's language
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
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
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
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Redirect to page according to user's language
You may need to do several checks. Take a look at the browser variable in $_SERVER["HTTP_ACCEPT_LANGUAGE"].
(#10850)
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
Re: Redirect to page according to user's language
arborint++
But always provide the option to switch.
But always provide the option to switch.