I am currently developing some extensions to use within TYPO3 6.
In one view I have database records with date fields. I can output the date values with the following:
<f:format.date format="d.m.Y H:i:s">{record.validend}</f:format.date>
However, I need a translated message, so I would like to use the translate view helper and put the formatted date in the arguments attribute. Without succes so far.
I tried:
<f:translate key="{msg_id}" arguments="{0: code, 1: {f:format.date(date: record.validend, format: 'd.m.Y H:i:s')}}" htmlEscape="0" />
…and…
<f:translate key="{msg_id}" arguments="{0: code, 1: {record.validend -> f:format.date(format: 'd.m.Y H:i:s')}}" htmlEscape="0" />
…following this guide: http://forge.typo3.org/projects/typo3v4-mvc/wiki/Fluid_Inline_Notation
However, there seems to be some syntax error in my notation forcing fluid to interpret the whole thing as a string, resulting in an error, cause the arguments attribut is expected to be an array.
Could anyone tell me if what I want is possible, and what syntax I need?
best regards
Christian
You need to escape the quotes of format with backslashes.
The solution is:
<f:translate key="{msg_id}" arguments="{0: code, 1: '{f:format.date(date: record.validend, format: \'d.m.Y H:i:s\')}'}" htmlEscape="false" />