Project

General

Profile

Actions

Bug #71191

closed

format.date - names are not translated

Added by Stephan Bauer over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2015-10-30
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When using format.date like this
<f:format.date format="l, d.m.Y">{event.date}</f:format.date>
names like month or day are always in english.
Using it like this it names are translated:
<f:format.date format="%A, %d.%m.%Y">{event.date}</f:format.date>

Would it be possible to use translation in both ways?

Also it would be great to define a default date format.

Actions #1

Updated by Martin Sonnenholzer over 8 years ago

The two formats use two different ways of php (1. DateFormat->format(); 2. strftime). The first one does only use English (http://php.net/manual/en/datetime.format.php#refsect1-datetime.format-notes) and the second one is localizable. So I think to localize both would be breaking to php in some way.

The second part about defining a default format would be cool :) (And yes I know the current default is Y-m-d), but it would be great to set something like this within typoscript.

Actions #2

Updated by Claus Due over 8 years ago

  • Status changed from New to Rejected

Already possible - from documentation:

Localized dates using strftime date format

<f:format.date format="%d. %B %Y">{dateObject}</f:format.date>

Output

13. Dezember 1980
(depending on the current date and defined locale. In the example you see the 1980-12-13 in a german locale)
Actions #3

Updated by Claus Due over 8 years ago

Would it be possible to use translation in both ways?

No, unfortunately not. One method uses date() the other uses strftime() and those two work quite differently. The date() format can't be used in strftime() and vice versa.

Also it would be great to define a default date format.

You should definitely do this using a {settings.foobar} variable. There are a few hinges preventing use of a default date format (unless you can indicate a cross-platform safe system option?). The issue is that it's an edge we would rather want to avoid - defining default behaviors of ViewHelpers using TypoScript. That being said, I will definitely consider a feature that would let you override default argument values - but I'm afraid you have to be a bit patient about that one; it would have to be in the standalone Fluid that won't be available as dependency until TYPO3 8. Once that hits you'll have a way to do this via the View (subsequently via the controller, possibly configured through TypoScript as a TYPO3-specific Fluid feature).

Actions #4

Updated by Stephan Bauer over 8 years ago

Thank you very much for the detailed answers.

I coundn't find any information about using strftime with format.date.
Maybe someone could add some information about localisation with strftime.
Also it would be great if someone could add this info to the Extbase and Fluid FAQ:
[[https://wiki.typo3.org/Extbase_und_Fluid_FAQ#How_can_I_render_localized_dates.3F]]

Actions

Also available in: Atom PDF