Localization in Visual Web Part

14/02/2013 11:32

Localization in Visual Web Part

We use label (in ascx file) to be displayed in different languages:

  <asp:Label ID="lblEmail" runat="server" Text="<%$Resources:MyResourceFileGlobal, EnterEmailLabelText%>"></asp:Label>
 
  We have more resource files which contains key: EnterEmailLabelText with translation
 
  MyResourceFileGlobal.en-US.resx
  MyResourceFileGlobal.nl-NL.resx
  MyResourceFileGlobal.resx
 
  Files are in solution in Module without Elements.xml file and each file properties are set as follows:
 
  BuildAction: Content
  DeploymentType: AppGlobalResource
  DeploymentLocation
  Root: {WebApplicationRoot}\App_GlobalResources\
  Path:
  
After deployment, files are copied to specified location, e. g. c:\inetpub\wwwroot\wss\VirtualDirectories\443\App_GlobalResources\