SPRegionalSettings.Locales property

Gets the collection of locales used in a server farm.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

public SPLocaleCollection Locales { get; }

Property value

Type: Microsoft.SharePoint.SPLocaleCollection
An SPLocaleCollection object that represents the locales.

The following code example displays all the locales that are represented on the root Web site.

using (SPSite oSiteCollection = new SPSite("http://localhost"))
    using (SPWeb oWebsiteRoot = oSiteCollection.RootWeb)
        SPRegionalSettings oRegionalSettings = oWebsiteRoot.RegionalSettings;
        SPLocaleCollection collLocalesAvailable = oRegionalSettings.Locales;

        foreach (SPLocale oLocaleAvailable in collLocalesAvailable)

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.