Last post Dec 23, 2008 03:07 PM by craigt-from-atl
Dec 22, 2008 12:31 PM|craigt-from-atl|LINK
I have a LinkButton like this:
<asp:LinkButton runat="server" ID="lbViewResults" text="<%$ Resources:Button, ViewResults %>" onclick="lbViewResults_Click" />
, it does not properly resolve the text when I switch languages.
I explicitly set the button text in the code-behind like this:
lbViewResults.Text = Resources.Button.ViewResults;
, it works just fine.
I know the simple answer is to just change it and always use the code-behind, but a large application has already been written using the first method.
I'm setting the UICulture in my OnPreInit method of my page.
I've seen some examples that override the "InitializeCulture()" method. I'm currently not doing this.
Dec 22, 2008 04:55 PM|craigt-from-atl|LINK
Is this even possible to do on the front-end? In looking at:
http://msdn.microsoft.com/en-us/library/fw69ke6f(VS.80).aspx, it states that "Depending
on the culture sent by the browser, ASP.NET will select the resource out of the file with the appropriate language or culture code within its file name, such as LocalizedText.fr.resx, LocalizedText.es-mx.resx,
or if no matching language is found, LocalizedText.resx."
So, according to this, the browser is ultimately used to determine the UIculture?
Dec 23, 2008 03:07 PM|craigt-from-atl|LINK
Ok, think I've got it figured out now. Originally, I didn't think I needed to override the "InitializeCulture" method, but it looks like that is indeed what I needed to do. Once I overrode this and properly checked for my language Session variable I was
setting, it all works. :)
I hope this helps out someone else that is following behind me.[Yes]