From d6a1b878d3ae2fb8c45320fbeba3ecf1023adf9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 24 Mar 2016 14:20:17 +0100 Subject: [PATCH] add the twig date extension The twig date extension allow to print message like "update 1 hour ago". Documentation here : http://twig.sensiolabs.org/doc/extensions/date.html --- Resources/config/services.yml | 7 +++++++ Resources/translations/date.fr.yml | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 Resources/translations/date.fr.yml diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 856342f22..34184ebf9 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -28,6 +28,13 @@ services: class: Twig_Extensions_Extension_Intl tags: - { name: twig.extension } + + twig_date: + class: Twig_Extensions_Extension_Date + arguments: + - "@translator" + tags: + - { name: twig.extension } chill.main.form.type.translatable.string: class: Chill\MainBundle\Form\Type\TranslatableStringFormType diff --git a/Resources/translations/date.fr.yml b/Resources/translations/date.fr.yml new file mode 100644 index 000000000..6d74d6d3a --- /dev/null +++ b/Resources/translations/date.fr.yml @@ -0,0 +1,7 @@ +#diff ago. See doc here : http://twig.sensiolabs.org/doc/extensions/date.html +diff.ago.second: '{1} Il y a une seconde | ]1,Inf] Il y a %count% secondes' +diff.ago.minute: '{1} Il y a une minute | ]1,Inf] Il y a %count% minutes' +diff.ago.hour: '{1} Il y a une heure | ]1,Inf] Il y a %count% heures' +diff.ago.day: '{1} Hier | ]1,Inf] Il y a %count% jours' +diff.ago.month: '{1} Le mois dernier | ]1,Inf] Il y a %count% mois' +diff.ago.year: '{1} Il y a un an | ]1,Inf] Il y a %count% ans'