KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm just trying to show the name of the months based on the current locale. {{ event.date|date('F') }} but the months are always shown in english... I have tried this code below I found here , but the result is the same... class Helper_Twig extends Twig_Extension { public function getFilters() { return array( 'datetime' => new Twig_Filter_Method($this, 'datetime') ); } public function datetime($d, $format = "%B %e") { if ($d instanceof \DateTime) { $d = $d->getTimestamp(); } return strftime($format, $d); } public function getName() { return 'Helper'; } } NOTE: In the controller I'm checking the current locale using $request->getLocale and it corresponds to the locale parameter I'm switching in parameters.yml. What is the problem?
Tags (comma-separated)
Save Edits
Cancel