Uploaded image for project: 'Bloomreach Forge'
  1. Bloomreach Forge
  2. FORGE-238

Thymeleaf: message parameters are not handled correctly

    XMLWordPrintable

Details

    Description

      It appears that the templating-support-thymeleaf library doesn't properly handle message parameters.

      Say we have a resource bundle message

      orderConfirmationMessage = Your order {0} is in the works. We sent an email to {1} with your order confirmation.
      

      and the fragment

      <div data-th-fragment="order-confirmation-message(order)">
          <div data-th-if="${order}">
              <hst:setBundle hst:basename="common-orders"/>
              <p data-th-text="#{orderConfirmationMessage(${order.orderNumber},${order.customerEmail})}"/>
          </div>
      </div>
      

      , then the output in the HTML document is

      Your order {0} is in the works. We sent an email to {1} with your order confirmation.
      

      This indicates that the order variable exists and that the common-orders resource bundle was properly loaded, but that the message parameters weren't included.
      After some debugging it turned out that Thymeleaf does correctly translate the message parameters, but that the placeholders are never replaced. The org.onehippo.forge.templating.support.thymeleaf.servlet.resolvers.HstMessageResolver does take the correct message parameters (i.e. the messageParameters array contains the values {"12345678","email@example.com}, but it doesn't do anything with them.

      Attachments

        Activity

          People

            mmilicevic Marijan Milicevic
            pim.nijssen Pim Nijssen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: