SPWeb.Language Property

Gets the locale identifier (LCID) for the default language of the website.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

<ClientCallableAttribute> _
Public ReadOnly Property Language As UInteger
Dim instance As SPWeb
Dim value As UInteger

value = instance.Language

Property Value

Type: System.UInt32
A 32-bit unsigned integer that indicates the LCID for the language. For a list of LCIDs, see the SPLocale.LCID property.

The default language of a website can be set only when the site is created. A site owner can subsequently turn on alternate languages by using the multilingual user interface or by setting the IsMultilingual property.

The following example is a console application that prints the LCID and display name for each language installed on the farm, the default language of the website, and each alternate language supported by the site.

Imports System
Imports System.Collections.Generic
Imports System.Globalization
Imports Microsoft.SharePoint

Module ConsoleApp

    Sub Main()
        Using site As New SPSite("http://localhost")
            Using web As SPWeb = site.OpenWeb()
                Dim format As String = "{0} | {1}"

                ' Display the languages installed on the farm.
                Console.WriteLine("Installed Languages")

                Dim languages As SPLanguageCollection = SPRegionalSettings.GlobalInstalledLanguages
                For Each language As SPLanguage In languages
                    Console.WriteLine(format, language.LCID, language.DisplayName)

                ' Display the default language for the website.
                Dim lcid As Integer = CInt(web.Language)
                Dim defaultCulture As New CultureInfo(lcid)

                Console.WriteLine(vbLf & "Default Language")
                Console.WriteLine(format, defaultCulture.LCID, defaultCulture.DisplayName)

                ' Display the alternate languages for the website.
                If web.IsMultilingual Then
                    Console.WriteLine(vbLf & "Alternate Languages")

                    Dim cultures As IEnumerable(Of CultureInfo) = web.SupportedUICultures
                    For Each culture As CultureInfo In cultures
                        If culture.LCID = defaultCulture.LCID Then
                            Continue For
                        End If

                        Console.WriteLine(format, culture.LCID, culture.DisplayName)
                End If

            End Using
        End Using
        Console.Write(vbCrLf & "Press ENTER to continue....")
    End Sub
End Module