Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to find country name and language in java

 
sunil soni
Greenhorn
Posts: 7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to find country name and language from where the request is coming I am using Locale class to find country name and language
but I am getting like this output

country name----United State
language----English

instead of

country name----India
language----Hindi

Is there any way to find country name and language from where the request are coming???

Please Help....
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only information you have is that sent in the request headers. You can examine those for the info that you seek, if it is there.
 
Saifuddin Merchant
Ranch Hand
Posts: 607
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and considering that most people have the locale set to either US or UK you might not much luck in determining where the request is coming from based on the header ...
 
Louis Bros
Ranch Hand
Posts: 54
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are quite a few free 'IP to location' databases around. You could match the remote address to a country that way.
 
sunil soni
Greenhorn
Posts: 7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Louis Bros wrote:There are quite a few free 'IP to location' databases around. You could match the remote address to a country that way.


Sir I didn't find any solution yet .I read about IP to location on internet but it need to be update every months

Is there any other solution for this , like other site can examine all the details of users . I need information like scribd website is using for the report purpose.
 
Louis Bros
Ranch Hand
Posts: 54
Java Tomcat Server Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can always use an 'Ip to location' API but you might have to deal with a lot more latency within your app.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Converting IP to location would give you the country, assuming accurate data, but it wouldn't necessarily give you the client's preferred language.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65223
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The client's preferred language will be sent as a request header. If they haven't set that properly in their browser, that's their problem, not yours.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic