I’ve just been programming some SharePoint extensions for a company running a german SharePoint (MOSS 2007) site, and I was astonished/amazed/annoyed by the fact that some parts of the SharePoint object model are heavily language-dependent. I mean such things as that the “official”, compile-time, property “Title” of a ListItem does simply not work in a german site collection, because it relies on the display name of the corresponding column.
This is why I will list some points what you should beware of if you want your thing to run in other languages than 1033:
- Do not use ListItem.Title – as mentioned above. If you use ListItem.Title, the property (IMHO) searches the ListItem for a field whose display name is “Title” and returns its value. I used that to access the “TemplateTitle” of a site template in the site templates gallery. In a german environment that column has “Titel” as its display-name, thus the property “Title” throws a RuntimeException. Instead, I used ListItem.GetFormattedValue(“TemplateTitle”), which is the internal column name which does not depend on language and cannot be changed by a user.
- Do not use “Full Control”, “Contribute”, … to refer to certain role definitions – I tried that, already sensing it might lead to troubles in a german environment. Of course, the role definitions are called “Vollzugriff”, etc. Thus, if you want to get a RoleDefinition object for “Full Control” / “Vollzugriff”, beware of using Web.RoleDefinitions[“Full Control”]. Instead, use the SPRoleType constants: Web.RoleDefinitions.GetByType(SPRoleType.Administrator)
- Do not use ~site/Pages/default.aspx as a hardcoded string – You guess it: In a german site collection, the thing is called ~site/Seiten/default.aspx. Besides, noone prevents a user from changing that URL in the document library’s settings. In WSS3, the default.aspx does not even reside in a document library but in the root path of the subsite: ~site/default.aspx. I have to admit that I’ve not yet discovered the correct way to get a site’s default.aspx page.
- I will expand this post as soon as i’ll stumble over another language hurdle.