Can't seem to over-ride browser language settings RRS feed

  • Question

  • User1147377280 posted

    I swear I had this working but now it is not. If I change the browser language then the proper resource file is used and the text shows up in french or english. I also have two flags on the page, however, and when the user clicks on the flag it is supposed to show the appropriate language. It is not. Below is the relevent code.

    First we have the page declaration...  

    <%@ Page Language="vb" AutoEventWireup="false" Inherits="ERSWeb.AnalysisMain" CodeFile="AnalysisMain.aspx.vb" Culture="auto" UICulture="auto" CodeFileBaseClass="ERSWeb.BasePage" meta:resourcekey="PageResource1" %>

    Next we have the click events for the flags...

    Protected Sub LanguageEN_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles LanguageEN.Click
        Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("en-CA")
    End Sub
    Protected Sub LanguageFR_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles LanguageFR.Click
        Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture("fr-CA")
    End Sub
     The page posts back but the language does not change. I'm clearly missing something simple. Anyone?
    Monday, November 20, 2006 7:02 PM

All replies

  • User1147377280 posted

    The problem is that the page inherits from a base class. Therefore, the InitializeCulture sub is fired before any of the events on the main page. I figured out a workorder using a session variable and response.redirect to itself.

    Kind of cheesy but I don't know any other way around it.

    Tuesday, November 21, 2006 12:26 PM