How to add localized .dwp/.webpart files to solution?

Nov 10, 2008 at 9:17 AM
SharePoint handles localization of strings in .dwp & .webpart files when deploying them to wpcatalog by allowing to create culture-specific subdirectories. E.g., for my webpart, I have the following hierarchy:

  \wpcatalog
    MyWebPart.webpart
    \ru-RU
      MyWebPart.webpart
    \fr-FR
      MyWebPart.webpart
    ...


.webpart files in subdirectories contain localized title and description strings for the corresponding cultures.

SP then uses the webpart files from the subdirectory corresponding to the culture of the site collection, or uses the .webpart file from top-level dir (i.e. wpcatalog itself) if no localized version is available.

The problem is that I cannot find a way to make WSPBuilder generate such a structure. It seems to ignore all subfolders of \80\wpcatalog in the solution, so only the top-level .webpart file is added to the solution, but not localized ones.

Am I missing something? Or is it just not yet implemented?



Dec 16, 2008 at 2:31 PM
Hi,

Yes.. You can deploy dwp/webpart files using WSPBuilder. Just create folder strcuture shown below under your wspbuilder project and create feature.xml and element.xml.

1. 12\TEMPLATE\FEATURES\<your feature name>

then under this folder, have your dwp files

2. Add Featur.xml as :
<Feature  Id="b203d767-2cc1-40b0-9e7e-702f6dbeba92"   Title="XXX"  Description="XXX"  Scope="Web" Hidden="False"  Version="1.0.0.0" 
  xmlns="http://schemas.microsoft.com/sharepoint/">

  <ElementManifests>
    <ElementManifest Location="element.xml"/>
    <ElementFile Location="your dwp file" />
  </ElementManifests>
</Feature>

3 Add element.xml as
<?xml version="1.0" encoding="utf-8" ?>

<Elements  xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module Name="WebParts" List="113" Url="_catalogs/wp">
    <File Url=" your dwp file name" Type="GhostableInLibrary">
      <Property Name="Group" Value="XXX"/>
    </File>
  </Module>
</Elements>

That's it!

Hope this helps


Cheers, Puru
www.purushotam.com


Dec 16, 2008 at 2:37 PM
I know how to add web parts in general - it is clearly described in the documentation. My question was about localized web parts - see the sample directory/file hierarchy in my original post (note that it is for a single localized web part!).