I have a requirement to implement globalization for the out of the box list forms i.e. displaying datetime, currency etc. based on culture of the region. I have referred this article on how SharePoint by default sets the thread culture using the SPRequest http module.

I have created a custom HttpModule that sets the CurrentCulture property of the thread and registered it after the SPRequest module. This works fine for layout pages and for custom webparts and I can see the datetime format being displayed on the region I choose. However this is not working for out of the box list forms i.e. AllItems.aspx, Editform.aspx, DisplayForm.aspx etc. I could see the thread culture being set in the httpmodule, but it does not have any effect on these forms.

This article says that list forms do not use .Net CultureInfo in these forms but instead use the LCID of SPWeb and then uses a COM library for formatting. This could well explain why changing the thread culture is not having any effect on list forms.

What is a good way to solve this? I don't have the option of creating one site per region based on locale. Also changing SPWeb.Locale is not an option.



I know you said changing the Locale is not an option, but what if your httpmodule changes the locale on the SPContext.Current.Web object but never calls web.update. This would mean any requests later in the pipeline that use that object would see your change but it would never persist in the DB. I am not sure if the com object code would "see" this change or not, but it's worth a try. Also I would do this on PreRequestHandlerExecute.

  • Thanks for the reply. I tried this, but didn't work.. – Rajesh May 7 '12 at 16:03
  • Figures. Those com objects probably query the db directly or use their own internal structures instead of looking at a managed code's object. – Steve Lineberry May 7 '12 at 16:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.