SPContentType.GetLocalizations 方法

返回指定的区域性的内容类型的本地化的集合。

命名空间:  Microsoft.SharePoint
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
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
)

参数

返回值

类型:Microsoft.SharePoint.SPLocalizationCollection
表示按内容类型支持的区域设置的字符串的字典。对于列表内容类型, SPLocalizationCollection对象是空引用(无 在 Visual Basic 中)。

示例

下面的示例是一个循环访问网站内容类型的集合,并打印的每种类型的本地化数的控制台应用程序的一部分。

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 类

SPContentType 成员

Microsoft.SharePoint 命名空间

其他资源

Introduction to Content Types

Site and List Content Types

Base Content Type Hierarchy