We are trying to set Regional Settings for new subsite in WebProvisioned event. Scenario is, we have two Variations site created, one for English and second for Arabic. We need to set Regional settings for Arabic site same as English site.
Problem that we are facing rite now is that when a site is created in English, its regional settings are "en-US", and when its variation site is created in Arabic (with timerjob execution), its regional settings remain Arabic (ar-SA) based(caldender is Hijri etc.).
We are using Event Receiver with WebProvisioned event, while debugging we found that, Regional settings for site created in Arabic are "en-US" (before we apply changes for regional settings forcefully). But when execution is finished, its regional settings are changed to "ar-SA". So its become useless to set regional settings in WebProvisioned event.
Below is the code we are using:
web.AllowUnsafeUpdates = true; var ci = new System.Globalization.CultureInfo("en-US"); var rs = new SPRegionalSettings(web, true); rs.LocaleId = (uint)ci.LCID; rs.Time24 = rs.GetDefaultTime24((uint)ci.LCID); rs.CalendarType = (short)rs.GetDefaultCalendarType(ci.LCID); rs.Collation = (short)rs.GetDefaultCollation(ci.LCID); web.RegionalSettings = rs; web.Update(); web.AllowUnsafeUpdates = false;
If site is directly created in Arabic subsite, its regional settings are perfect. But when created with timerjob, this code executes succefully, but regional settings are default of Arabic.
What should we do?