question about UICulture in asp.net

  • Thread starter Thread starter Alex
  • Start date Start date
A

Alex

I have a question about asp.net.
I'm trying to create a multilingual site with resources and stuff, it
works ok, but what is the difference between
using:

UICulture = "en" or using Thread.CurrentThread.CurrentUICulture = new
CultureInfo("en"); ?!
Both work well. (i have a base page where i override
InitializeCulture)
(i only need language, no currency, that's why i only use "en" and not
"en-US")
 
Hi,
I have a question about asp.net.
I'm trying to create a multilingual site with resources and stuff, it
works ok, but what is the difference between
using:

UICulture = "en" or using Thread.CurrentThread.CurrentUICulture = new
CultureInfo("en"); ?!
Both work well. (i have a base page where i override
InitializeCulture)
(i only need language, no currency, that's why i only use "en" and not
"en-US")

en-US is a culture not just a currency settings. It allows you, for
example, to specify different texts for en-US and en-UK. I wouldn't
dismiss the culture that fast.

As for UICulture in the Page class, it does the same then setting the
CurrentUICulture directly. However, note the fine print:

"This property supports the .NET Framework infrastructure and is not
intended to be used directly from your code."

Quoted from:
http://msdn2.microsoft.com/en-us/library/system.web.ui.page.uiculture.aspx

Means that the implementation can change any time without warning. I
would rather set the UICulture in the Page directive, in the Web.config,
or else using the "Thread.CurrentThread" code above.

Greetings,
Laurent
 
Back
Top