SPContentType.GetLocalizations method
SharePoint 2013
Returns the collection of localizations for the content type for the specified culture.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.UnsupportedSPType)]
public SPLocalizationCollection GetLocalizations(
CultureInfo cultureInfo
)
Parameters
- cultureInfo
- Type: System.Globalization.CultureInfo
An object that specifies a culture.
Return value
Type: Microsoft.SharePoint.SPLocalizationCollectionA dictionary of strings that represent the locales that are supported by the content type. For a list content type, the SPLocalizationCollection object is null.
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();