4 Replies Latest reply on Jun 25, 2018 11:52 AM by Sanford Whiteman

    Localize Date Format in Token (Velocity)

    L. Perez

      I am trying to create different tokens (each language a separate token), that will display the date format in the specified language.

       

      Examples:

      English Token: March 31, 2018

      French Token: 31 mars 2018

      Spanish Token: 31 de marzo de 2018

      Portuguese Token: 31 de março de 2018

       

      So far, I have the English token formatted correctly but specifying a language for the other tokens is not working.

       

      English Token:

       

      #set( $inTimeZone = $date.getTimeZone().getTimeZone('America/New_York') )

      #set( $outTimeZone = $date.getTimeZone().getTimeZone('America/New_York') )

      #set( $locale = $date.getLocale() )

      #set( $myDate = $convert.parseDate($lead.Member_Expire_Date,'yyyy-MM-dd',$locale,$inTimeZone) )

      ${date.format('d MMMM, yyyy',$myDate,$locale,$outTimeZone)}

       

      Do we have to load a library of locales prior to defining it? Any other suggestions?

       

      I would like to do this without web hooks.