次の方法で共有


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

'Declaration
Public Function GetLocalizations ( _
    cultureInfo As CultureInfo _
) As SPLocalizationCollection
'Usage
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
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("https://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("https://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