Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-94220

Text fragment renders number fields in the same format, regardless language

    Details

      Description

      • Have some languages enabled in your site. For the purposes of this issue, we'll use en_US, fr_FR and es_ES
      • Create a WC structure, add a Decimal field to it. Save
      • Create a display page template, add a text fragment and map it to the Decimal field
      • Save and mark it as the default
      • Create a web content using that structure. Inform the number -1234567.89 in en_US. Add translations to fr_FR and es_ES, ensure all languages get that same number. Publish
      • Add an Asset Publisher to the welcome page  (or some other widget page). Ensure new content is shown.
      • Visit the asset publisher page in several languages by just prepending the locale in the URL path (en_US/, fr_FR/, es_ES/). Then, click in the content to navigate to the display page.

       Observed: display page shows the same number format for all the languages (-1234567.89)

       Expected: number should be properly formatted depending on the language, as follows:

      • en_US → -1,234,567.89
      • fr_FR → -1 234 567,89
      • es_ES → -1.234.567,89

      Note: following groovy script displays -1234567.89 formatted to portal locales

      import com.liferay.portal.kernel.language.LanguageUtil;
      import java.text.NumberFormat;
      
      number=-1234567.89
      for (Locale l : LanguageUtil.getAvailableLocales()) {
        out.println(l.toString() + " → " + NumberFormat.getNumberInstance(l).format(number));
      }
      

      Reproduced in master at 59bcd5727ce3b5984e39f2d09a1ef16566b69af2

        Attachments

          Activity

            People

            • Assignee:
              kyle.miho Kyle Miho
              Reporter:
              daniel.sanz Daniel Sanz
              Participants of an Issue:
              Recent user:
              Kyle Miho
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                30 weeks ago

                Packages

                Version Package
                Master