Working on a multilingual project, I had to come up with an approach for implementing resources values used across our UI solution on the SharePoint 2010 platform. Unlike for SharePoint 2007, there is more flexibility on the new 2010 platform to implement your resx files. I found that there were two approaches that can be used on order to deploy your Resource files using Visual Studio 2010 with SharePoint 2010.
Using the Empty Element
This is the approach I choose because it fit my requirements best. Using the Visual Studio templates, add a new ‘Empty Element’ to your project and call it ‘Resources’ (you can name it whatever you’d like):
In that folder, I added all my resx files that I will be using for my project:
For each resx file, make sure you update its properties. I have changed the deployment type to ‘AppGlobalResource’:
Using the mapped folder
For SharePoint specific resource files, it makes more sense to use the predefined ‘Resources’ mapped folder in the Visual Studio 2010.
Any resource files added to that mapped folder will be copied to the 14/Resources/ folder on the SharePoint server where the solution is deployed. If you wish to use that mapped approach but would like to have your resx files copied to the web application folder as well, you will need to edit the manifest.xml file and the ApplicationResourceFiles element to the <Solution> element such as:
<ApplicationResourceFiles>
<App_GlobalResourceFile Location=”SharePointUIResourcesApplication.fr-FR.resx” />
<App_GlobalResourceFile Location=”SharePointUIResourcesApplication.zh-CN.resx” />
</ApplicationResourceFiles>
Using the Empty Element
This is the approach I choose because it fit my requirements best. Using the Visual Studio templates, add a new ‘Empty Element’ to your project and call it ‘Resources’ (you can name it whatever you’d like):
In that folder, I added all my resx files that I will be using for my project:
For each resx file, make sure you update its properties. I have changed the deployment type to ‘AppGlobalResource’:
Using the mapped folder
For SharePoint specific resource files, it makes more sense to use the predefined ‘Resources’ mapped folder in the Visual Studio 2010.
Any resource files added to that mapped folder will be copied to the 14/Resources/ folder on the SharePoint server where the solution is deployed. If you wish to use that mapped approach but would like to have your resx files copied to the web application folder as well, you will need to edit the manifest.xml file and the ApplicationResourceFiles element to the <Solution> element such as:
<ApplicationResourceFiles>
<App_GlobalResourceFile Location=”SharePointUIResourcesApplication.fr-FR.resx” />
<App_GlobalResourceFile Location=”SharePointUIResourcesApplication.zh-CN.resx” />
</ApplicationResourceFiles>