I been stepping through the code as described in the videos for Master pages
and site Navigation and the one for localization.
I get the idea behind both but I'm trying to put em together to put together
a web site that is localized AND uses master pages, whose controls (labels
etc.) can also be localized.
This is the code I came up with in the Defaultaspx page to permit the
modification of the controls depending on a language seleceted in the
dropdown list on the page, in my default.aspx.vb file (language1 is the name
of the dropdownlist on that page)
Imports System.Globaliz ation
Imports System.Threadin g
Partial Class _Default
Inherits System.Web.UI.P age
Protected Overrides Sub InitializeCultu re()
Dim loc As String = Request("langua ge1")
If Not IsNothing(loc) Or loc <"" Then
Thread.CurrentT hread.CurrentUI Culture = New CultureInfo(loc )
Thread.CurrentT hread.CurrentCu lture = CultureInfo.Cre ateSpecificCult ure(loc)
Else
Thread.CurrentT hread.CurrentUI Culture = New CultureInfo("fr-CA")
Thread.CurrentT hread.CurrentCu lture =
CultureInfo.Cre ateSpecificCult ure("fr-CA")
End If
Session("Locale ") = loc
End Sub
If I include the default.aspx file in a master page, the
Request("langua ge1") remains at nothing, how should I handle the change of
language in the dropdownlist when using master pages. I thought it would
remain handled the same way.
Also when I change the language selected in the default page, I will need to
change the contents of controls that are on the master page, how can I do
that?
I was thinking just now of placing the language selector on the master page
and have a change there 'trickle down' to all the other open pages, is this
possible and if so how?
If anyone has sample bits of code for doing this I would appreciate it very
much
Regards,
Bob
and site Navigation and the one for localization.
I get the idea behind both but I'm trying to put em together to put together
a web site that is localized AND uses master pages, whose controls (labels
etc.) can also be localized.
This is the code I came up with in the Defaultaspx page to permit the
modification of the controls depending on a language seleceted in the
dropdown list on the page, in my default.aspx.vb file (language1 is the name
of the dropdownlist on that page)
Imports System.Globaliz ation
Imports System.Threadin g
Partial Class _Default
Inherits System.Web.UI.P age
Protected Overrides Sub InitializeCultu re()
Dim loc As String = Request("langua ge1")
If Not IsNothing(loc) Or loc <"" Then
Thread.CurrentT hread.CurrentUI Culture = New CultureInfo(loc )
Thread.CurrentT hread.CurrentCu lture = CultureInfo.Cre ateSpecificCult ure(loc)
Else
Thread.CurrentT hread.CurrentUI Culture = New CultureInfo("fr-CA")
Thread.CurrentT hread.CurrentCu lture =
CultureInfo.Cre ateSpecificCult ure("fr-CA")
End If
Session("Locale ") = loc
End Sub
If I include the default.aspx file in a master page, the
Request("langua ge1") remains at nothing, how should I handle the change of
language in the dropdownlist when using master pages. I thought it would
remain handled the same way.
Also when I change the language selected in the default page, I will need to
change the contents of controls that are on the master page, how can I do
that?
I was thinking just now of placing the language selector on the master page
and have a change there 'trickle down' to all the other open pages, is this
possible and if so how?
If anyone has sample bits of code for doing this I would appreciate it very
much
Regards,
Bob