*
The moose likes Servlets and the fly likes How to find country name and language in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to find country name and language in java" Watch "How to find country name and language in java" New topic
Author

How to find country name and language in java

sunil soni
Greenhorn

Joined: Nov 16, 2010
Posts: 7

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....


Sunil
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Saifuddin Merchant
Ranch Hand

Joined: Feb 08, 2009
Posts: 597

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 ...


Cheers - Sam.
Twisters - The new age Java Quiz || My Blog
Louis Bros
Ranch Hand

Joined: Jun 03, 2011
Posts: 54

There are quite a few free 'IP to location' databases around. You could match the remote address to a country that way.


OCA7
sunil soni
Greenhorn

Joined: Nov 16, 2010
Posts: 7

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

Joined: Jun 03, 2011
Posts: 54

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
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

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

Joined: Jan 10, 2002
Posts: 60050
    
  65

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to find country name and language in java
 
Similar Threads
How to find in which jsp is session parameter declared?
struts2 decimal point or decimal comma
Sending HTML form to group email
compassion
Struts2 Internationalization