Using resource files for Web Template:

  1. How to add a localized Title to a list instance?
  2. How to add a localized Title to a web part added in ONET.XML?
  3. how to add localized terms in a CEWP contents added in ONET.XML?

Add the mapped folder called RESOURCES to you solution and then add you resx files there.

If you want to add your resx files in the App_GlobalResource folder in the IIS, then add an Empty Element to you solution, add your resx files to that and modify the SharePointSolutionItem.spdata to target the App_GlobalResource folder like so:

<?xml version="1.0" encoding="utf-8"?> 
<ProjectItem Type="Microsoft.VisualStudio.SharePoint.GenericElement" DefaultFile="Elements.xml" SupportedTrustLevels="All" SupportedDeploymentScopes="Web, Site, WebApplication, Farm, Package" xmlns="http://schemas.microsoft.com/VisualStudio/2010/SharePointTools/SharePointProjectItemModel"> 
 <ProjectItemFile Source="Elements.xml" Target="App_GlobalResources\" Type="ElementManifest" /> 
 <ProjectItemFile Source="..\Resources\Contoso.resx" Type="AppGlobalResource"/>

Then make sure there is a Feature which contains that Empty Element and that the Feature has its scope to WebApplication.

|improve this answer|||||
  • How to reference those resources in the example cases? – thomius Jan 6 '14 at 13:22
  • @thomius <property name="Title" type="string">$Resources:Contoso, MyWebPartTitle;</property> – user2536 Jan 6 '14 at 13:25
  • How the example 3: contents of CEWP? (or is it the same) – thomius Jan 6 '14 at 13:26
  • @thomius <Content xmlns="//schemas.microsoft.com/WebPart/v2/ContentEditor">$Resources:Contoso, MyCEWPText;</Content> – user2536 Jan 6 '14 at 13:32

Create new "Import SharePoint Solution Package" from Installed templates project and select your web template that you import from sharepoint than add resource file to your solution:

  • add Resource File project items to your project. If you do not have to localize code in addition to the markup, you can instead add Global Resources Files.
  • Provide a name for the default language resource file.
  • Give the localized resource files the same name appended with the language-specific culture ID. For example, MyAppResources.de-DE.resx for German and MyAppResources.ja-JP.resx for Japanese.
  • Set the Deployment Type property of each resource file to AppGlobalResource. This causes the resource files to deploy to the App_GlobalResources folder, where they are available to all ASPX pages and controls in the solution. The App_GlobalResources folder is located in C:\inetpub\wwwroot\wss\VirtualDirectories\\App_GlobalResources. Then replace all string in all artifacts(list, modules, pages..) to use your new resource file. Examples how to localize list instances, web parts you can find using this link.
|improve this answer|||||
  • How to reference those resources in the example cases? – thomius Jan 6 '14 at 13:22
  • For example for list instance name: Name="$Resources:MyResources,ListInstance_News" MyResources - name of the resources file (as described below) ListInstance_News - the resource entry And the name of Resources file (for the entry above) for English should be: MyResources.en-US.resx – Andrey Ungur Jan 6 '14 at 13:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.