An Example Using MessageManager

In this example, you will convert an existing rc.xml file that supports EN-US and FR-FR cultures to .resx files, generate resources and satellite assemblies, and then modify the web.config file.

For this example, the base name of the resources is MessageManagerResources, as specified in the sample web.config file.

Viewing the rc.xml File

Using the RCXML2Resx Tool

Generating Satellite Assemblies Using the Command Prompt

Editing the web.config File

Viewing the rc.xml File

The sample format of the rc.xml file is as follows:

<?xml version="1.0"?>
<MessageManager>
        <Language Name="English"    Locale="1033"/>
        <Language Name="French"     Locale="1036"/>
        <Entry Name=" pur_badsku" Type="_Basket_Errors ">
                <Value Language="English"> Please note that one or more
                       items were removed from your order because the 
                       product is no longer sold.
                </Value>
                <Value Language="French"> Notez qu'un ou plusieurs
                       articles ont été supprimés de votre commande car le 
                       produit n'est plus en vente.
                </Value>
          </Entry>
</MessageManager> 

Using the RCXML2Resx Tool

The sample command syntax is as follows:

  • RCXML2Resx C:\Inetpub\wwwroot\CommerceWebApp\rc.xml MessageManagerResources.resx

This will generate the following files in the current directory:

  • MessageManagerResources.en-US.resx
  • MessageManagerResources.fr-FR.resx

MessageManagerResources is the base name used for this example. You can use a different base name to generate .resx files.

Generating Satellite Assemblies Using the Command Prompt

Creating satellite assemblies by using the command prompt is a three-step process:

  1. Use the following commands to create the resource files:
    • resgen MessageManagerResources.en-US.resx
    • resgen MessageManagerResources.fr-FR.resx
  2. Make sure that both folders, en_US and fr_FR, are created under the \Bin folder under the Commerce Server project. In this example, the Commerce Server project name is CommerceWebApp, and it is located at C:\Inetpub\wwwroot\.
  3. Generate satellite assemblies for each culture and place them in the appropriate folders. At the command prompt, type:
    • al /embed:MessageManagerResources.en-US.resources /culture:en-US /out:C:\Inetpub\wwwroot\CommerceWebApp\bin\en-us\CommerceWebApplication.resources.dll
    • al /embed:MessageManagerResources.fr-FR.resources /culture:fr-FR /out:C:\Inetpub\wwwroot\CommerceWebApp\bin\fr-FR\CommerceWebApplication.resources.dll

Alternatively, you can use Visual Studio .NET to generate your satellite assemblies. Visual Studio .NET automatically creates the resources and directories for you. For information about using Visual Studio .NET to generate satellite assemblies, see To build satellite assemblies using Visual Studio .NET

Editing the web.config File

The final step in using the MessageManager object is to edit the web.config file. In this example, information provided earlier is entered in the messageManager tag in the web.config file.

The sample web.config file is as follows:

 <messageManager>
<cultures default="en-US" BaseName="MessageManagerResources" assembly="CommerceWebApplication">
               <culture id="en-US" />
               <culture id="fr-FR" />
       </cultures>
       <resources>
               <resource id="pur_badsku" />
       </resources>

</messageManager>

Copyright © 2005 Microsoft Corporation.
All rights reserved.