asp2: setting UICulture via code does not work any more (always germanResources)?

  • Thread starter =?ISO-8859-1?Q?Roland_M=FCller?=
  • Start date
?

=?ISO-8859-1?Q?Roland_M=FCller?=

Hello,

we have converted our project to framework 2.0 but we have still some
problems, one of it with setting the UICulture for a aspx-site.

Example: there is a simple aspx test site in a solution with two resx
files in the App_GlobalResources folder:

- ffTest.en.resx
- ffTest.resx

Both contain a testkey/testvalue "String1".
I have a label:
<asp:Label ID="test1" runat="server" Text="<%$ Resources:ffTest, String1
%>"></asp:Label>

If i set the UICulture in the Page directive (i try "de-DE" and "en-GB")
the page shows the correct text, in german and in english (according to
the setting in the Page directive).

But i MUST do this via code as in framework 1.1, i try both of the
following in Page_Load:

System.Threading.Thread.CurrentThread.CurrentUICulture = new
System.Globalization.CultureInfo("en-GB");

OR

Page.UICulture = "en-GB";

But the lable always shows the german value of the resource file!!!!!!!!

What do i wrong?
Thanks, Roland
 
?

=?ISO-8859-1?Q?Roland_M=FCller?=

Found a solution, do:

protected override void InitializeCulture() {
System.Threading.Thread.CurrentThread.CurrentCulture = new
System.Globalization.CultureInfo("en-GB");
System.Threading.Thread.CurrentThread.CurrentUICulture = new
System.Globalization.CultureInfo("en-GB");

base.InitializeCulture();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top