views:

259

answers:

3

My main purpose is to show different page to different country(language) people. I think it should be based on the user region/country, which I guess can fetch out from ip address?

example: *For EN country people, they would see this. www.example.com

*For Japanese, they would dispatch to this. www.example.com/jp

Also I saw some people said to accomplish these purpose, the best way is based on the web-browser language, which can get from http header. I don't know which is better, what is the common way and why..?

Thanks for your advices!

I'am using Flex and Java.

+3  A: 

Zolo, you can use something like the geoip database from maxmind to easily find region/country/province from IP addresses, but it has a few drawbacks:

  • VPNs and caches can yield false values
  • User's can't easily override it.

Going with the browser's Accept: headers is generally preferred because a Spanish speaking person in the US can set their language settings to get 'es' instead of 'en' even if their IP would get them 'en'.

When I've had to do this in the past I ended up with an ordered preference list within the language selection logic, with each level overriding the subsequent ones if present:

  1. Expressed user preference by slicking a flag icon on site, stored in session or cookie
  2. The TLD of the domain, with .com signifying nothing (ex: mycompany.jp gets you Japanese site, but mycomany.com is a "no vote" and passes through to the next level
  3. Browser language setting from the accept header
  4. GeoIP best guess
  5. Fallback to English

The goal, of course being to base the selection on things that most accurately reflect the preferences of the user.

Ry4an
Ry4an, thanks for your answer. I think your ordered preference list is the best way to achieve my goal. I'm still a beginner full of thoughts, lack of technology... Your answer let me know the possibilities. Thanks a lot!
kinopyo
+1  A: 

IP2Location offers several different ways to get this information (they have the data necessary to do an IP address lookup). This includes a web service which costs $49 per year, or you can buy the data directly from them for the same price.

Kaleb Brasee
I think I would try some free IP Geolocaiton services first.Thanks anyway.
kinopyo
+1  A: 

Figuring out the language of choice for a user of a web application is...

tricky business !

See this related SO Question or also this one.

Another useful hint is to use the keyword GeoLocation, although finding the location and the language of choice are two related but distinct problems.
For example if geolocation indicates downtown Geneva, French might be the language of choice, but, German, English and several other languages are almost as probable.

I got the following URLs from the SO questions afore mentioned:

Free IP geolocation services

  • IPGeo: www.ipgeo.com
  • MaxMind GeoIP:http://www.maxmind.com/

Commercial IP geolocation services

For language identification (rather than location), it is convenient and typically more accurate to use the HTTP Header's "accept-language" value, but that too can be misleading. Although someone may have a Japanese version of the browser installed he/she may prefer reading in English...

No matter what language you offer the users, by default, be sure to allow them to easily switch to another version of the site (and if possible, to remember this choice for when they return to your site)

mjv
Thanks for your answer. The Links you posted really helps.
kinopyo