SPContentType.GetLocalizations Method

Returns the collection of localizations for the content type for the specified culture.

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

Syntax

Public Function GetLocalizations ( _
    cultureInfo As CultureInfo _
) As SPLocalizationCollection

Dim instance As SPContentType
Dim cultureInfo As CultureInfo
Dim returnValue As SPLocalizationCollection

returnValue = instance.GetLocalizations(cultureInfo)
public SPLocalizationCollection GetLocalizations(
    CultureInfo cultureInfo
)

Parameters

Return Value

Type: Microsoft.SharePoint.SPLocalizationCollection
An SPLocalizationCollection object that contains a dictionary of strings that represent the locales that are supported by the content type. For a list content type, the SPLocalizationCollection object is a null reference (Nothing in Visual Basic).

Examples

The following example is part of a console application that iterates through the collection of site content types and prints the number of localizations for each type.

Dim site As SPSite = New SPSite("http://localhost")
Dim web As SPWeb = site.OpenWeb()

Console.WriteLine("The site locale is " + web.Locale.Name)
Console.WriteLine("The culture identifier (Lcid) is " + web.Language.ToString())

For Each contentType As SPContentType In web.ContentTypes
    Dim localizations As SPLocalizationCollection = _
        contentType.GetLocalizations(web.Locale)
    Console.Write("The {0} content type has ", contentType.Name)
    Console.WriteLine(" {0} localizations", localizations.Count.ToString())
Next contentType

' Clean up.
web.Dispose()
site.Dispose()
SPSite site = new SPSite("http://localhost");
SPWeb web = site.OpenWeb();

Console.WriteLine("The site locale is " + web.Locale.Name);
Console.WriteLine("The culture identifier (Lcid) is " + web.Language.ToString());

foreach (SPContentType contentType in web.ContentTypes)
{
    SPLocalizationCollection localizations = 
        contentType.GetLocalizations(web.Locale);
    Console.Write("The {0} content type has ", contentType.Name);
    Console.WriteLine(" {0} localizations", localizations.Count.ToString());
}

// Clean up.
web.Dispose();
site.Dispose();

See Also

Reference

SPContentType Class

SPContentType Members

Microsoft.SharePoint Namespace

Other Resources

Introduction to Content Types

Site and List Content Types

Base Content Type Hierarchy

SPContentType Object Overview