PDA

View Full Version : SpringAir QuickStart


Bruno Baia
10-25-2005, 10:33 AM
"Culture "sr" is a neutral culture. It can not be used in formatting and parsing and therefore cannot be set as the thread's current culture. "


Thread.CurrentThread.CurrentCulture = UserLocale;
Thread.CurrentThread.CurrentUICulture = UserLocale;


if UserLocale.IsNeutralCulture == true, we have this error.
I got same problem with fr-FR

EDIT : I saw there was modifcation in CVS about that since last Web Preview, i will test it again tonight.

sebastijanp
10-26-2005, 12:50 PM
What happened to this issue? How do I resolve that?

Lp
S

sebastijanp
10-26-2005, 01:03 PM
I also get that if I call:

CultureResolver.SetCulture(new CultureInfo(defaultCulture));

Line 866: {
Line 867: CultureResolver.SetCulture(value);
Line 868: Thread.CurrentThread.CurrentCulture = value;
Line 869: Thread.CurrentThread.CurrentUICulture = value;
Line 870: OnUserCultureChanged(EventArgs.Empty);

[NotSupportedException: Culture "sl" 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(Cult ureInfo culture) +110
System.Threading.Thread.set_CurrentCulture(Culture Info value) +17
Spring.Web.UI.Page.set_UserCulture(CultureInfo value) in d:\support\cbp\websource\trunc\cbpweb\spring.web\w eb\ui\page.cs:868
NSphere.Web.NSpherePage.SetLanguage(Object sender, CommandEventArgs e) in d:\support\cbp\websource\trunc\cbpweb\nsphere.web\ nspherepage.cs:56
System.Web.UI.WebControls.ImageButton.OnCommand(Co mmandEventArgs e)
System.Web.UI.WebControls.ImageButton.System.Web.U I.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()


Lp
S

sebastijanp
10-26-2005, 01:59 PM
I read on google that the problem is when you try to set just "sl".
I must set "sl-SI" which is not neutral.

So I corrected in Spring/Page...

protected override void OnInit(EventArgs e)
{
string userLocaleTwoLetterISOLanguageName = UserCulture.Name; //UserCulture.TwoLetterISOLanguageName;
string defaultCulture = ConfigurationSettings.AppSettings.Get ("DefaultCultureInfo");
bool applyDefaultCultureInfo = (bool)Session["ApplyDefaultCultureInfo"];
if (applyDefaultCultureInfo)
{
CultureResolver.SetCulture(new CultureInfo(defaultCulture));
}
else
{
CultureInfo culture = new CultureInfo(userLocaleTwoLetterISOLanguageName);
CultureResolver.SetCulture(culture);
}
Thread.CurrentThread.CurrentCulture = UserCulture;
Thread.CurrentThread.CurrentUICulture = UserCulture;

But just locally. Probably you have some other solution...

Lp
S

Bruno Baia
10-26-2005, 02:14 PM
hi,

i make it work. I think there is a bug.

From MSDN Article "Resources in ASP.NET Applications" :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconresourcesinasppages.asp

The CurrentCulture property expects a specific culture, that is, one that is associated with both a language and a region, such as ("de-AT") for German in Austria. The neutral culture "de" will not work because it is associated only with a language. To create a CultureInfo object in the format that the CurrentCulture property expects, use the CultureInfo.CreateSpecificCulture method. This method creates a CultureInfo object that represents the specific culture associated with a specified neutral culture. The following example uses the CultureInfo.CreateSpecificCulture method to create a CultureInfo object that represents the specific culture associated with neutral culture "de", and uses it to initialize the value of the CurrentCulture property.

"Spring Web Preview" :
In the Spring.Web.Localization.Resolvers.DefaultWebLocale Resolver.GetDefaultLocale() method, replace

return new CultureInfo(context.Request.UserLanguages[0]);

by

return CultureInfo.CreateSpecificCulture(context.Request. UserLanguages[0]);


"Spring Interim build" (October 25 , 2005) :
Same in Spring.Globalization.Resolvers.DefaultWebCultureRe solver.GetDefaultLocale() method.

Aleks Seovic
10-27-2005, 02:47 AM
Cool, I will apply your fix and check it in.

Thanks,

Aleks

sebastijanp
11-11-2005, 07:22 AM
Hi

This fix is not checked in? Or is it solved some other way?

Lp
S

Aleks Seovic
11-11-2005, 10:08 AM
Thanks for another reminder :)

I actually changed the code as suggested, but SF.net CVS doesn't seem to be working at the moment.

I'll commit changes in the morning, gotta get at least a few hours of sleep now...

Later,

Aleks