L
Lloyd Dupont
I created a
==============
public class LangModule : IHttpModule
{
public void Dispose() {}
public void Init(HttpApplication application)
{
HttpContext context = application.Context;
HttpCookie lc = context.Request.Cookies[LangCookieName];
if (lc == null)
return;
CultureInfo ci = new CultureInfo(lc.Value);
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}
public static string LangCookieName = "UserSelectedLanguage";
public static void SetLocale(HttpContext context, CultureInfo locale)
{
if (locale == null)
return;
HttpCookie lc = new HttpCookie(LangCookieName, locale.Name);
lc.Expires = DateTime.Now.AddDays(360);
context.Response.Cookies.Add(lc);
Thread.CurrentThread.CurrentCulture = locale;
Thread.CurrentThread.CurrentUICulture = locale;
}
}
==============
SetLocale() is successfully called by a LinkButton to either "en-AU" or "fr-FR" and the Init() method is called when there is an incoming query.
I'm trying to test if it works with a very simple literal:
==============
<asp:Literal runat="server" Text="<%$ Resources: Standart, Email %>" />
==============
And in App_GlobalResources I have 2 resources: "Standart.resx" & "Standart.fr-FR.resx".
However I always get the default (English) label, I never get the French label.
Any idea what I'm missing or I have done wrong?
==============
public class LangModule : IHttpModule
{
public void Dispose() {}
public void Init(HttpApplication application)
{
HttpContext context = application.Context;
HttpCookie lc = context.Request.Cookies[LangCookieName];
if (lc == null)
return;
CultureInfo ci = new CultureInfo(lc.Value);
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;
}
public static string LangCookieName = "UserSelectedLanguage";
public static void SetLocale(HttpContext context, CultureInfo locale)
{
if (locale == null)
return;
HttpCookie lc = new HttpCookie(LangCookieName, locale.Name);
lc.Expires = DateTime.Now.AddDays(360);
context.Response.Cookies.Add(lc);
Thread.CurrentThread.CurrentCulture = locale;
Thread.CurrentThread.CurrentUICulture = locale;
}
}
==============
SetLocale() is successfully called by a LinkButton to either "en-AU" or "fr-FR" and the Init() method is called when there is an incoming query.
I'm trying to test if it works with a very simple literal:
==============
<asp:Literal runat="server" Text="<%$ Resources: Standart, Email %>" />
==============
And in App_GlobalResources I have 2 resources: "Standart.resx" & "Standart.fr-FR.resx".
However I always get the default (English) label, I never get the French label.
Any idea what I'm missing or I have done wrong?