SPUserResource.SetValueForUICulture method

Sets the value of the resource for the specified culture.

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

public void SetValueForUICulture(
	CultureInfo cultureInfo,
	string value


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.

using System;
using System.Globalization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;

namespace ConsoleApp
    class Program
        static void Main(string[] args)
            using (SPSite site = new SPSite("http://localhost"))
                using (SPWeb web = site.RootWeb)
                    web.QuickLaunchEnabled = true;
                    web.IsMultilingual = true;

                    SPList list = web.Lists.TryGetList("Announcements");
                    if (list != null)
                        // Create a navigation node pointing to the Announcements list.
                        SPNavigationNode newNode = new SPNavigationNode(list.Title, list.DefaultViewUrl);

                        // Add the node to the Quick Launch area.
                        SPNavigationNodeCollection quickLaunch = web.Navigation.QuickLaunch;

                        // Copy translations of the list's title to the user resource for the node's title.
                        string localizedTitle;
                        SPUserResource titleResource = newNode.TitleResource;
                        foreach (CultureInfo culture in web.SupportedUICultures)
                            localizedTitle = list.TitleResource.GetValueForUICulture(culture);
                            newNode.TitleResource.SetValueForUICulture(culture, localizedTitle);
            Console.Write("\nPress ENTER to continue....");