Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I need to get a SharePoint list title in a specified language and i am trying to use the SPUtility.GetLocalizedString Method:

public static string GetLocalizedString(
    string source,
    string defaultResourceFile,
    uint language
)

The problem is that i don't know what to place in the source parameter, and the default resource file where SharePoint stores list names.

Thank you for your help.

share|improve this question
add comment

3 Answers 3

up vote 1 down vote accepted

Thank tou guys for your answers, the solution was simpler than i thought.

To get an SPList title in a specified language (culture) we can use the TitleResource property.

splist.TitleResource.GetValueForUICulture(culture);
share|improve this answer
add comment

According to the documentation on MSDN, you should use the following:

source: 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: 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.

In your case, I would think you should use:

GetLocalizedString("$Resources:custList", "core", 1033) //1033 for English

I got the values from looking at the CustomList definition at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\CustomList\ListTemplates\CustomList.xml on my SharePoint installation.

share|improve this answer
    
'custList' always returns 'Custom List'. If i want to iterate thru all SPlists with what i need to replace it? –  user3470 Feb 27 '12 at 9:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.