Develop > Controller layer > Application developer > Support globalization > Globalized catalog content > Globalization in the messaging system


Encode for e-mail transmission

For e-mail transmissions where the content must be encoded, the various messaging commands choose the encoding based on the following hierarchy:

The outbound messaging task command (SendMsgCmd) uses the messaging system object (Messaging) to create and send messages. The encoding selection hierarchy depends on whether the messaging task command specifies a Member_ID (CmdSendMsg.addMember(getUserID) or not.

If the member_ID is specified

Determine the proper encoding:

If the member_ID is not specified

Use the site default language. The messaging system object (Messaging) sets the preferred language to "DefaultLang" which gets replaced with the site default language by the E-mail adapter's code.

The outbound messaging system uses JavaServer page composition templates for a number of message types (see the product documentation for more information about this topic).

Globalization enabled e-mail messaging

When a message of one of these types is generated within WebSphere Commerce, the message composition service uses the corresponding template to create the outbound message. Once it is created, the outbound message can be sent through whatever transports have been assigned to the message type in the Administration Console.

To illustrate the concept of JSP composition template and the various globalization capabilities of the outbound messaging system, the following is an end-to-end example about how to implement a globalization enabled e-mail messaging command:


Procedure

  1. Initialize com.ibm.commerce.messaging.commands.SendMsgCmd in the command implementation in order to create a message:

    com.ibm.commerce.messaging.commands.SendMsgCmd sendMsgCmd =
     (com.ibm.commerce.messaging.commands.SendMsgCmd)
    CommandFactory.createCommand(SendMsgCmd.NAME, getStoreId());
    

    The getStoresJS method creates a JavaScript array with all information entitled to the user according to the access control policy. The information includes the stores that the user is entitled to access, the fulfillment centers of those stores, and the languages supported by each of the stores. The following is an example of a JavaScript array created by a call to the getStoresJS method:

  2. Retrieve the translated subject of the message:

    Locale locale = getCommandContext().getLocale();
    ResourceBundle property = (ResourceBundle)
    ResourceBundle.getBundle("yourPropertyFile", locale); 
    String subject = property.getString("SUBJECT_CONTENT");
    

  3. Pass in the translated subject line with the setConfigData method defined in SendMsgCmd:

    sendMsgCmd.setConfigData("subject", subject);
    

  4. Retrieve the translated content of the message:

    // assume you are using storeId 1
    sendMsgCmd.setStoreID(new Integer(1)); 
    // the default Message Type ID for Password Reset Notification view
    name is "PasswordNotify" (that is MSGTYPES.NAME).
    sendMsgcmd.setMsgType("PasswordNofity"); 
    // pass the viewName, commandContext and TypedProperty to compose the message
    // the default MSGTYPES.VIEWNAME of Password Reset Notification is PasswordNotifyView. 
    // If null is specified, the default view name will be used. 
    // A different view name can be specified.
    sendMsgCmd.compose("PasswordNotifyView", getCommandContext(), typedProperty);
    

  5. Create the view JSP of the command...

    1. Retrieve the locale as shown in the following:

      ...
      <c:set var="localeOwn" value="${CommandContext.locale}"/>
       ...
      <html> ...
      ...
      <param name="LOCALE" value="${localeOwn}"/> ...
      ...
      </html> 
      

    2. Retrieve the corresponding properties file and get the translated text to generate the content of the message:

      ...
      <c:set var="locale" value="${CommandContext.locale}"/> 
      ...
      <fmt:setLocale value="${CommandContext.locale}" />
      <fmt:setBundle basename="${path}PasswordResetNotification"
      var="bnResourceBundle" />
       ...
       ...
      <title><fmt:message key="eMarketingSpot_UpSellCrossSell"
      bundle="${bnResourceBundle}"/></title> 
      


Results

The JSP associated with the view command generates the globalization enabled message to be delivered to the outbound messaging queue (temporarily stored in MSGSTORE table).

The following table shows examples of message types that use message composition templates. Use these templates and their associated commands as a reference when building the own messaging commands and composition templates.

Message type JSP template Path
OrderCreateXMLFormat OrderCreateXML.jsp

OrderStatusNotify OrderStatusNotify.jsp

PasswordReset PasswordResetNotification .jsp


Related concepts

Support globalization

Globalization in the messaging system

Localized store assets


Related tasks

Create a globalized store

Configure a Web application

Related reference

Globalization tips

massload utility (Server environment)


+

Search Tips   |   Advanced Search