SPUtility.SetThreadCulture Method (SPWeb)
Sets the thread and user interface (UI) culture, based upon the spWeb parameter and the RegionalSettings property of the user.
Namespace: Microsoft.SharePoint.Utilities
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
<SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)> _
Public Shared Sub SetThreadCulture ( _
spWeb As SPWeb _
)
'Usage
Dim spWeb As SPWebSPUtility.SetThreadCulture(spWeb)
[SubsetCallableExcludeMemberAttribute(SubsetCallableExcludeMemberType.PerSpec)]
public static void SetThreadCulture(
SPWeb spWeb
)
Parameters
spWeb
Type: Microsoft.SharePoint.SPWebThe SPWeb object that is used to set the thread and UI culture according to the Locale and Language properties.
Remarks
The culture of the thread is set based on the LocaleId property of the SPRegionalSettings class for the current user.
If the user cannot be determined, the culture is set based on the Locale property of the SPWeb class.
The UI culture of the thread is set based on the UICulture property and the IsMultilingual property of the SPWeb class, and some HTTP request headers.
If the SPWeb object is not multilingual, then the UI culture of the thread is set to the UICulture property of the SPWeb object; otherwise, it uses the following algorithm.
If the HTTP request has an lcid cookie and the spWeb supports the language represented by the lcid cookie,
The UI culture of the thread is set to that language
Else
For Each Language in the Accept language header
{
If the spWeb supports that language,
{
The UI culture of the thread is set to that language
Break;
}
}
If the force value is false, then the culture will not be set if a previous call to SetThreadCulture has been made.