Globalization problem

  • Thread starter Thread starter FM
  • Start date Start date
F

FM

Hi,

I use the following code to set the current culture.

If Not IsNothing(Session("language")) Then
System.Threading.Thread.CurrentThread.CurrentCulture = New
System.Globalization.CultureInfo(Session("language").ToString)

End If

If the users's browser (IE) is configured in the languages section to
support Japanese (ja) I get the following error when I go on the page:

Culture "ja" is a neutral culture. It can not be used in formatting and
parsing and therefore cannot be set as the thread's current culture.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NotSupportedException: Culture "ja" is a neutral
culture. It can not be used in formatting and parsing and therefore cannot
be set as the thread's current culture.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[NotSupportedException: Culture "ja" is a neutral culture. It can not be
used in formatting and parsing and therefore cannot be set as the thread's
current culture.]
System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) +110
System.Threading.Thread.set_CurrentCulture(CultureInfo value) +17
ASPNetPortal.DesktopDefault.Page_Init(Object sender, EventArgs e) +208
System.Web.UI.Control.OnInit(EventArgs e) +67
System.Web.UI.Control.InitRecursive(Control namingContainer) +235
System.Web.UI.Page.ProcessRequestMain() +171





Any idea why this is hapening and what should I do would be much
appreciated.
Thanks,
Florian Marinoiu
 
Florian,

Try providing the region information as well in order to create a specific
culture rather than a neutral culture. e.g.: "ja-JP instead" of just "ja".

HTH,
Nicole
 
Florian,

Try providing the region information as well in order to create a specific
culture rather than a neutral culture. e.g.: "ja-JP instead" of just "ja".

HTH,
Nicole
 
Back
Top