共用方式為


SPContentType.GetLocalizations method

傳回指定的文化特性的內容類型的當地語系化資源集合。

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
)

參數

傳回值

Type: Microsoft.SharePoint.SPLocalizationCollection
字串,表示內容的型別所支援的地區設定的字典。對清單的內容類型, SPLocalizationCollection物件就是a null reference (Nothing in Visual Basic)。

Examples

下列範例會逐一查看集合的網站內容類型,並將列印的每一種類型的當地語系化資源數目的主控台應用程式的一部分。

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

請參閱

參照

SPContentType class

SPContentType members

Microsoft.SharePoint namespace

其他資源

Introduction to Content Types

Site and List Content Types

Base Content Type Hierarchy