R
Robert Dufour
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.Globalization
Imports System.Threading
Partial Class _Default
Inherits System.Web.UI.Page
Protected Overrides Sub InitializeCulture()
Dim loc As String = Request("language1")
If Not IsNothing(loc) Or loc <> "" Then
Thread.CurrentThread.CurrentUICulture = New CultureInfo(loc)
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(loc)
Else
Thread.CurrentThread.CurrentUICulture = New CultureInfo("fr-CA")
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("fr-CA")
End If
Session("Locale") = loc
End Sub
If I include the default.aspx file in a master page, the
Request("language1") 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.Globalization
Imports System.Threading
Partial Class _Default
Inherits System.Web.UI.Page
Protected Overrides Sub InitializeCulture()
Dim loc As String = Request("language1")
If Not IsNothing(loc) Or loc <> "" Then
Thread.CurrentThread.CurrentUICulture = New CultureInfo(loc)
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(loc)
Else
Thread.CurrentThread.CurrentUICulture = New CultureInfo("fr-CA")
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture("fr-CA")
End If
Session("Locale") = loc
End Sub
If I include the default.aspx file in a master page, the
Request("language1") 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