I haven't a clue whether or not this is the most practical way to go, but I used an ip-to-country.csv file and compared that to the user's IP, which in turn was returned by a php function.
It works pretty well when I need to automatically set the language settings to German, Finnish or English, depending on where the user is coming from.
I could email a .zip for you, if you'd like. At the very least you can decide if that's the way to go or not.