SPUtility::GetLocalizedString method

Retrieves the value for a named resource string from the resource file for a specified language.

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

No code example is currently available or this language may not be supported.

Parameters

source
Type: System.String

An ASP.NET resource expression in the form $Resources:keyname, where keyname is the name half of a name/value pair in a resource file (.resx).

defaultResourceFile
Type: System.String

The base file name of the language resource file containing a localized string value. For example, if you have a series of resource files named myresources.en-us.resx, myresources.es-es.resx, myresources.de-de.resx, and so on, the value to pass in this parameter is myresources.

language
Type: System.UInt32

The LCID of the target language. For a list, see the overview topic for the CultureInfo class.

Return value

Type: System.String
The string value for the specified language. If a value cannot be found in the requested language, the value for the invariant language is returned. If a resource file for the invariant language does not exist or the specified resource name does not exist, the source string is returned without localization.

This method can retrieve a string value from a resource file located in the Resources folder that is just below the SharePoint Foundation installation root. The token that Visual Studio uses for this folder is {SharePointRoot}\Resources. The full path is %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\Resources.

The following example is a console application that enumerates the languages supported by a Web site. For each language, the application gets the value for the resource named "onet_TeamSite" from the resource file with the base file name "core".

No code example is currently available or this language may not be supported.
Show: