SPUserResource.SetValueForUICulture method

Sets the value of the resource for the specified culture.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Public Sub SetValueForUICulture ( _
	cultureInfo As CultureInfo, _
	value As String _
Dim instance As SPUserResource
Dim cultureInfo As CultureInfo
Dim value As String

instance.SetValueForUICulture(cultureInfo, _


Type: System.Globalization.CultureInfo

An object that identifies a culture.

Type: System.String

A string that contains the value of the resource in the specified culture.


cultureInfo is null .

The following example is a console application that creates a new navigation node that links to the Announcements list and adds the node to the Quick Launch area of a Web site. The application then iterates through the list of languages supported by the Web site's multilingual user interface and calls SetValueForUICulture to write localized values from the Announcement list's TitleResource property to the node's TitleResource property.

Imports System
Imports System.Globalization
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Navigation

Module ConsoleApp

    Sub Main()
        Using site As New SPSite("http://localhost")
            Using web As SPWeb = site.OpenWeb()

                web.QuickLaunchEnabled = True
                web.IsMultilingual = True

                Dim list As SPList = web.Lists.TryGetList("Announcements")
                If list IsNot Nothing Then
                    ' Create a navigation node pointing to the Announcements list.
                    Dim newNode As New SPNavigationNode(list.Title, list.DefaultViewUrl)

                    ' Add the node to the Quick Launch area.
                    Dim quickLaunch As SPNavigationNodeCollection = web.Navigation.QuickLaunch

                    ' Copy translations of the list's title to the user resource for the node's title.
                    Dim localizedTitle As String
                    Dim titleResource As SPUserResource = newNode.TitleResource
                    For Each culture As CultureInfo In web.SupportedUICultures
                        localizedTitle = list.TitleResource.GetValueForUICulture(culture)
                        newNode.TitleResource.SetValueForUICulture(culture, localizedTitle)
                End If

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

End Module