Save way to detect Browser Language

Discussion in 'ASP .Net' started by Matthias S., Mar 30, 2005.

  1. Matthias S.

    Matthias S. Guest

    Hi all!

    What is the best way to detect the Browsers preferred language
    (HTTP_ACCEPT_LANGUAGE)? Having Trace enabled I used a couple of
    different Browser and figured, that they all send a different format for
    this information. Is there a sort-of failsafe approach to it?

    Thanks in advance!

    --
    /Matthias
     
    Matthias S., Mar 30, 2005
    #1
    1. Advertising

  2. Matthias S.

    Brock Allen Guest

    Check the Request.UserLanguages collection.

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen



    > Hi all!
    >
    > What is the best way to detect the Browsers preferred language
    > (HTTP_ACCEPT_LANGUAGE)? Having Trace enabled I used a couple of
    > different Browser and figured, that they all send a different format
    > for this information. Is there a sort-of failsafe approach to it?
    >
    > Thanks in advance!
    >
     
    Brock Allen, Mar 30, 2005
    #2
    1. Advertising

  3. Matthias S.

    cauzon

    Joined:
    Dec 28, 2007
    Messages:
    1
    navigator.browserLanguage

    Hi Everyone,

    I'm dharyl from Philippines, I had a problem in knowing the user's browser Language. I was asked to have an alert pop up when the user of the site is using other language than "en-us".
    I had this code below just to test what language setting should the page read from the user.

    Code: ( javascript )
    <script language="JavaScript">
    var a = navigator.browserLanguage;
    var b = navigator.userLanguage;
    var c = navigator.systemLanguage;
    alert("browser language");
    alert(a);
    alert("user language");
    alert(b);
    alert("system language");
    alert(c);
    </script>


    Code: ( text )
    navigator.browserLanguage --> en-us
    navigator.systemLanguage --> en-us
    navigator.userLanguage --> en-us


    when I change my browser language from Tools>InternetOptions>General>Languages
    results are the same:

    Code: ( text )
    navigator.browserLanguage --> en-us
    navigator.systemLanguage --> en-us
    navigator.userLanguage --> en-us


    when I change my browser language from
    Start>ControlPanel>RegionalandLanguageOptions>Regional Options tab
    the value of userLanguage changes just as what I set:

    Code: ( text )
    navigator.browserLanguage --> en-us
    navigator.systemLanguage --> en-us
    navigator.userLanguage --> Ja


    That means navigator.userLanguage is for this one
    Start>ControlPanel>RegionalandLanguageOptions>Regional Options tab

    Now my point is how would I get the value of language setting from this one?
    Tools>InternetOptions>General>Languages

    Because I guess that's what I need for my task to be done.
    Hope you guys can help me on this.


    Thanks in advance,
    dha
     
    cauzon, Dec 28, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. user
    Replies:
    1
    Views:
    782
    Bruce Barker
    Apr 4, 2005
  2. Quinn
    Replies:
    5
    Views:
    325
    Griff
    Jul 8, 2005
  3. Chris Fynn

    How to detect client language?

    Chris Fynn, Oct 28, 2003, in forum: Javascript
    Replies:
    5
    Views:
    207
    Dr John Stockton
    Nov 24, 2003
  4. mbasil7
    Replies:
    1
    Views:
    100
  5. Replies:
    0
    Views:
    516
Loading...

Share This Page