Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-3312

Freemarker templates render doubles in system locale

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • High
    • Resolution: Won't Fix
    • 2.30.00, CMS-10.0-FCS
    • CMS-10.0-GA
    • None

    Description

      Freemarker templates render double values in the system locale instead of the locale of the current mount/channel.

      Steps to reproduce:
      1. use a Dutch OS, or set the locale of your OS to Dutch
      2. add a field of type 'Double' to a document type (e.g. the 'news' document from Essentials' 'news' feature)
      3. set a double value "0.5" in a document of that type (zero dot five)
      4. edit the template that renders that document, and make it render the double too. For example, add:

      ${document.myDouble}

      5. request the page in the site and check the rendered double value

      Expected: the double renders as 0.5 (zero dot five)
      Actual: the double renders as 0,5 (zero comma five)

      This is especially annoying if the double is used in a fmt tag, for example:

      <@fmt.formatNumber value="${document.myDouble}" type="currency"/>

      Since 0,5 is not a valid Java double, rendering the template will generate an error.

      It is questionable whether doubles should be rendered locale-specific at all. Probably they should always be rendered in dot-notation (zero dot five) so they remain valid Java doubles.

      This mainly affects developers that are using a non-dutch OS. Servers will probably always run an OS with English locale.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mdenburger Mathijs den Burger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: