Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Carter 1 post 21 karma points
    Jan 23, 2013 @ 22:49
    Carter
    0

    After upgrade, Dictionary items fail when CurrentUICulture set form HttpModule

    I have a few international sites running umbraco where I've created a class inheriting from IHttpModule and in the contextBeginRequest() method setting the following:

    string Lang = "fr-FR";

    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Lang);
    Thread.CurrentThread.CurrentUICulture = new CultureInfo(Lang);

    I can see the breakpoints hit on these lines when debugging, but they no longer control the dictionary.  Interestly, I found a way around this issue by adding the following Razor code to my site template:

    <umbraco:Macro runat="server" language="cshtml">
        @Helper.SetLanguage()

    </umbraco:Macro>

    SetLanguage() executes:

    string Lang = "fr-FR";
    Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang);        Thread.CurrentThread.CurrentUICulture = new CultureInfo(lang);

    Thanks,

    -Carter

     

Please Sign in or register to post replies

Write your reply to:

Draft