AnsweredAssumed Answered

How to I18N FTL date display ?

Question asked by yva on Sep 6, 2010
Latest reply on Sep 6, 2010 by savic.prvoslav
Hi,

I am working with alfresco 3.2r2

How to internationalize the display of a date within à freemarker template ?

In the following code sample
the ${child.properties["cm:created"]?datetime} code
always displays the date in the same language,
whatever the user language preferences of my user.

Has anybody any hint on which FTL code to use to internationalize
the display of the creation date of a document ?

Thanks in advance


<#– Table of docs in a specific folder, that have been created last 3 days –>
<h3>${template.properties.description}</h3>
<table cellpadding=2>
   <tr>
      <td></td>
      <td><b>${message("project.template.name")}</b></td>
      <td><b>${message("project.template.created")}</b></td>
   </tr>
   <#list space.childrenByXPath[".//*[subtypeOf('cm:content')]"]?sort_by(['properties','cm:name']) as child>
      <#if (dateCompare(child.properties["cm:created"], date, 1000*60*60*24*3) == 1) && (child.properties.name?ends_with(".pdf") )>
         <tr>
            <td><a href="/alfresco${child.url}" target="new">${child.properties.name}</a></td>
            <td>${child.properties["cm:created"]?datetime}</td>
          </tr>
      </#if>
   </#list>
</table>

Outcomes