Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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 the below articles on how SharePoint by default sets the thread culture using the SPRequest http module.

http://sadomovalex.blogspot.co.uk/2010/01/how-sharepoint-sets-currentthreadcurren.html

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 http://dotnet.lv/blogs/antonsm/archive/2008/12/21/change-date-format-in-sharepoint.aspx 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.

Thanks

share|improve this question

1 Answer 1

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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