views:

216

answers:

2

Are there any other built-in classes similar to SPBuiltInFieldId and SPBuiltInContentTypeId?

I am creating a feature that will be deployed to both English and Polish site collections. It uses a custom Web Service - when I need to access some list or Web Part, I have to check the current language and use a proper name ("Site Template Gallery" or "Galeria szablonów witryn", "Site Image" or "Obraz witryny").

Is there a better way to do it?

+2  A: 
SPList list = pubSite.RootWeb.GetCatalog(SPListTemplateType.MasterPageCatalog);

is that something like what you´re looking for?

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.splisttemplatetype.aspx

Otherwise if you´re looking for a way to get the list by its internal name you can have a look at this post instead: http://johanleino.spaces.live.com/blog/cns!6BE273C70C45B5D1!294.entry

UPDATE:

If you need to get a resource from 12\Template\Resources you can use something like:

SPUtility.GetLocalizedString("$Resources: dcl_schema_view_allitems", "core", 1053);

This will get the value from the key dcl_schema_view_allitems from the core.resx with swedish locale. Edit to fit your needs.

Johan Leino
Thanks for the answer. However, SPListTemplateType won't work, since many list can use the same list template; the 2nd link looked promising, but internal name in this case unfortunately means the URL of the list, so it's rather cumbersome, too (e.g. the URL of Site Template Gallery is /_catalogs/wt/ - not very intuitive).
Marek Grzenkowicz
+1  A: 

So your question is more along the lines of "How can I find the name of a SharePoint artifact in another language?"

There are two main locations:

  1. C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Resources
  2. The App_GlobalResources subfolder of the IIS web site that SharePoint is using. For example: C:\Inetpub\wwwroot\wss\VirtualDirectories\80\App_GlobalResources

The resource files are all XML. Find the text you need in the language you are most comfortable with and make a note of the XML node details. Then open the file for the other language(s) and use XPath, LINQ or your favourite XML technology to read the corresponding value in that language.

Alex Angas