Export (0) Print
Expand All

SPContentType.GetLocalizations Method

Windows SharePoint Services 3

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

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

public SPLocalizationCollection GetLocalizations(
	CultureInfo cultureInfo
)

Parameters

cultureInfo
Type: System.Globalization.CultureInfo
A CultureInfo object that specifies a locale.

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).

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.

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();

Community Additions

ADD
Show:
© 2014 Microsoft