Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

Language change!

Hi all,

I'm trying to get my application to detect what language the browser is set to, then make changes accordingly. So far I have:

Dim lang As String
lang = Request.QueryString("Language")
If lang = "it" then
Sidebar3.CssStyle = "sidebar h2"
End if

Open in new window

this didn't work, so I played around with trying 'language' instead of 'Language', and 'it-IT" instead of "it" but nothing seems to work.

Then I thought that maybe the string 'lang' wasn't working as it should, so I tried a


Open in new window

nothing was written at all. As you can see in the first 'code' - I'm trying to change the CSS class of sidebar3 (an asp label) if the browser language is set to Italian. I've also tried doing a Select Case - this yields the same result, nothing.

I'm using IE8 and Chrome for testing, no variations on results for either.

Any help will be appreciated!

  • 2
  • 2
1 Solution

have you looked into the folowing?


(querystring is only for passing values with a [get]-form)

jonathangodwinAuthor Commented:
Oh ok, so what would be the best way for me to achieve the objective in my original post? I tried:

Dim userLang() As String
        Dim count As Integer

        userLang = Request.UserLanguages
        For count = 0 To userLang.GetUpperBound(0)
            Response.Write("User Language: " & CStr(userLang(count)) & "<br>")
        Next count

which returns:

User Language: en-GB
User Language: it;q=0.8
User Language: en-US;q=0.6
User Language: en;q=0.4

but what can I do to isolate one of the above in an If statement?


jonathangodwinAuthor Commented:
Dim lang As String = Request.UserLanguages(0).ToString
if lang = "it" Then
SideBar3.CssClass = "<your css class goes here>"
End If

is how to do it for future reference for people
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to and use offer code ‘EXPERTS’ to get 10% off your first purchase.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now