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

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



      • Have some languages enabled in your site. For the purposes of this issue, we'll use en_US, de_DE, es_ES and hi_IN
      • Create a WC structure, add a Date field to it. Save
      • Create a display page template, add a text fragment and map it to the Date field
      • Save and mark it as the default
      • Create a web content using that structure. Inform the date April, 1st, 2019 in en_US. Add translations to de_DE, es_ES and hi_IN, ensure all languages get that same date. 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/, de_DE/, es_ES/ and hi_IN/). Then, click in the content to navigate to the display page.

       Observed: display page shows the same date format for all the languages

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

      • en_US → 4/1/19
      • de_DE → 01.04.19
      • hi_IN → १/४/१९
      • es_ES → 1/04/19

      Note: following groovy script displays "April, 1st, 2019"  formatted to portal locales

      import com.liferay.portal.kernel.language.LanguageUtil;
      import java.text.DateFormat;
      c = Calendar.getInstance();
      for (Locale l : LanguageUtil.getAvailableLocales()) {
        out.println(l.toString() + " → " + DateFormat.getDateInstance(DateFormat.SHORT, l).format(c.getTime()));

      Reproduced in master at 59bcd5727ce3b5984e39f2d09a1ef16566b69af2




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


              • Created:
                Days since last comment:
                1 year, 22 weeks, 2 days ago


                Version Package