SharePoint provides options to create sites with different types of locales available out of the box. Suppose we have a SharePoint site built using the English locale and we want to change the existing site to some other locale then this can be achieved using the following piece of code. Changing the locale of the site helps display the date and number formats with their respective decimal and group separators. The example below shows changing an existing SharePoint site into Italian locale.
CultureInfo cultInfo = new CultureInfo("it-IT", false); NumberFormatInfo noFormatInfo = cultInfo.NumberFormat; foreach (CultureInfo cInfo in CultureInfo.GetCultures(CultureTypes.AllCultures)) { if (!cInfo.IsNeutralCulture) { DateTimeFormatInfo dtformat = cInfo.DateTimeFormat; NumberFormatInfo nformat = cInfo.NumberFormat; if (cInfo.LCID == cultInfo.LCID && dtformat.ShortDatePattern == "dd/MM/yyyy" && nformat.NumberDecimalSeparator == noFormatInfo.NumberDecimalSeparator&& nformat.NumberGroupSeparator == noFormatInfo.NumberGroupSeparator) { using (SPSite site = new SPSite("http://sharepointSite")) { using (SPWeb web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; web.Locale = cInfo; web.Update(); } } } } }