Resource files + VS 2010 = 2 properties on the feature (Pre MUI series)

Hey everyone

I don’t know how many of you already noticed 2 properties on the feature that has something to do with resources.

Given that I want to create a complete A-Z guide concerning MUI in SharePoint, I’m going to explain these 2 properties in detail.

 

image

 

There are 6 locations where the resource files can be stored, but today we are going to focus on:

  1. feature resources: <hive>14TEMPLATEFEATURES<feature>Resources
  2. 14 hive resources: <hive>14Resources

 

Default Resource File:

 

image

 

As you can see I have Feature resource files in the “VisualWP” feature. But I also have “MuiResource” files in the “Resources” mapped folder to the 14 hiveResources .

Now the default resource file option on the feature is a sort of overruling mechanism. If the feature resource files are outdated or no longer displaying the correct text (or any excuse that you can give to it) than the redirect will happen to the 14 hive resource files. So if you have “VisualWPFeatureTitle” and “VisualWPFeatureDescription” in your feature resources and in 14 hive resource files than an overrule will happen and the values from  the 14 hive resources will be used in the appropriate language. The feature resources will be ignored.

Also no mix mode is possible, if you only want to use the title from the 14 hive resource files and the description from the feature resources than this isn’t possible.

So why would you want to do this?

If you want to use the resource values on more than 1 location (across web applications for example) than this is a possibility. So you have your feature resource files deployed but you want to use the same resource values in a totally different solution. A problem will come up because you cannot get to the values in the feature resource file. So you’ll have to deploy the same key/values in a 14 hive resource file. Meaning duplication of data, which is never good Glimlach .

So it’s best to override the feature resource files to the 14hive resource files and keep all the key/values in 1 location.

This option adds an argument in the xml structure of the xml file as shown below.

 

image

Require resources:

This option is a Boolean value meaning only true or false can be entered.

By default this option is set to false.

What this does is checking if the feature has feature resource files, if yes than the feature will be displayed in the features list. If a feature resource language file isn’t located that the feature will not be shown in the list. This is designed to prevent a feature from being displayed with the ugly “$Resources:FeatureTitle;” notation when a language resource file cannot be found.

Note that overruling the resource files in the previous option is not sufficient.

The feature resource files must exist, but they can be empty though.

Only than the system will get the values from the 14 hive resource files and will be shown in the features list of site.

 

Next up Part 1 of the MUI series.

Leave a Reply

Your email address will not be published. Required fields are marked *