Reputation: 689
I don't want anything incredibly complicated. I am working on a client outside the US, and I just want a basic check to see if someone is accessing his page from the US or not. After that, I am going to default the language in either English or Spanish, after determining where the visitor is from.
Thanks.
Upvotes: 0
Views: 3880
Reputation: 66
MaxMind gives away a free copy of their IP address location database. It's accurate enough for country specific. I'd suggest using the binary version though as it will be much faster than loading it in something like MySQL. They provide a PHP API in addition to more sophisticated methods.
But as others have said, IP address is a poor thing to set language on. If I'm traveling in Mexico and load your page with my browser that requests English you shouldn't be sending me Spanish simply because I'm in Mexico.
Upvotes: 0
Reputation: 23016
Why not use internationalization with php? it works based on users browser settings. I wouldn't like to see a different language just because I am in a different country ;-) I had tough time when Google started showing search results and options in French when I was in Paris for a short time.
Upvotes: 5
Reputation: 181460
You can use a service like ip2location or you can just use this easier PHP technique to get locale information from the visitor.
Upvotes: 0