Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Save way to detect Browser Language

Reply
Thread Tools

Save way to detect Browser Language

 
 
Matthias S.
Guest
Posts: n/a
 
      03-30-2005
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
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      03-30-2005
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!
>




 
Reply With Quote
 
 
 
 
cauzon cauzon is offline
Junior Member
Join Date: Dec 2007
Posts: 2
 
      12-28-2007
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>Regi onal 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>Regi onal 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Browser close event (MSIE and FF): how to detect browser close ? pamelafluente@libero.it Javascript 0 01-23-2007 12:44 AM
How do I detect which button was clicked on "save/open/cancel" dialog? Quinn ASP General 5 07-08-2005 12:09 PM
Is there a way to detect the width of the browser scrolling bar? mbasil7 Javascript 1 07-01-2005 12:06 AM
Save contents of iframe from parent's save button user ASP .Net 1 04-04-2005 07:44 PM
How to detect client language? Chris Fynn Javascript 5 11-24-2003 04:18 PM



Advertisments