In my current SharePoint development project there has been the requirement to get the localized (german) name (role definition) for the ‘Approve’ permission. OK - one thing to do that is to open a site, change its language to ‘German’ and have a look at the permissions. In that case you would find, that the ‘Approve’ permission is called ‘Genehmigen’ in german.
But that’s not a good way to do that - I’m sure you’ll agree.
Unfortunately you can’t use SPRoleType in that case, because ‘Approve’ is not listed here.

But there is another way to get the localized name: you can use the StringIds class. In this class you’ll find lots of resource ids that can be used to get localized strings from internal SharePoint resources. Simply have a look on the members of that class. In my case I can use this resource:

And here is a little snippet showing how to get localized strings by using the StringIds class:

Although this snippet is intended to be used with SharePoint 2013, you can use it with SharePoint 2010 (and SharePoint 2007) too. Just change the version number when loading the assembly.

Bereitgestellt
8 Okt 2013 15:41
von
Oliver Wirkus