Detecting Country and Language from Browser

Discussion in 'C#' started by Enrio, Sep 19, 2006.

  1. #1
    Maybe it's not the better forum for this question but... here i am.

    Does anybody knows how to find the country and the language to make the web multilanguage?

    I am doing something with asp.net but it seems not working well:

    If use request.Userlanguages I get "es" because it's spanish. But when I use currentculture i get "en-US" instead of "es-ES" that is what i should get in Spain.

    Any suggestion?
     
    Enrio, Sep 19, 2006 IP
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    you should get the IP and find what country it belongs to and don't ever use a browser.

    if you search you'll find for ready databases with the country and IP lists
     
    ludwig, Sep 19, 2006 IP
  3. Enrio

    Enrio Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, but I finally have solved with the request.userlanguages.

    The browser tells the language and the country that the user wants, so that I think that is better than the IP.

    The problem is that i was looking for an "es-es" result when it was "es". For other countries gives things like "en-us" or "es-mx". So that the language is the left(xxx,2) and the country is the right(xxx,2). Then no problem whether the format is "xx" or "xx-yy".
     
    Enrio, Sep 19, 2006 IP
  4. BurgerKing

    BurgerKing Active Member

    Messages:
    397
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    58
    #4
    BurgerKing, Sep 19, 2006 IP
  5. Enrio

    Enrio Peon

    Messages:
    87
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I will take a look.

    Thanks
     
    Enrio, Sep 19, 2006 IP
  6. Software_outsourcing

    Software_outsourcing Peon

    Messages:
    298
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You have to first locate the IP of the user who is connecting to the website . COmpare the Ip with the database stored( which people like ip2location.com can provide you ) .Thus you can comfartable determine the country of orgin of the users and thereafter u can use it the way u want.
     
    Software_outsourcing, Oct 16, 2006 IP