I just started developing a multilingual webpage which site users can read and post entries without registration. (It's based on Facebook "like button" and "comment social plugin".)
In most case i use Hostip.info to get users language from their ip (based on location) but it's not enought good. In other case i must relies on browsers language (because of unlocated ip开发者_开发百科 address).
I must find a reliable way to decide where my users come from and what language they are speak. I'll be thankful if somebody can help me.
(Temporary i solved the problem with a popup alert box which everybody can set their own locale. In the near future i want just a simple warn that says "You speak english. It's right?")
The request http header should have a "Accept-Language" which you can try and use. I would suggest setting a cookie on the user's preference so that they do not keep getting a different language if they are visiting a foreign country for argument sake.
$_SERVER["HTTP_ACCEPT_LANGUAGE"];
$_SERVER["HTTP_ACCEPT_CHARSET"];
精彩评论