From 5d7f8a422b878321820e771bafe8c22179adfa89 Mon Sep 17 00:00:00 2001 From: MicioBaus Date: Sun, 14 Dec 2014 23:02:26 +0100 Subject: [PATCH] Added localization for datepicker DatePicker plugin features an option for including text to display on the trigger button: "buttonText". Since it would be nice if it were possible to have this message to change when varying users' locale, I added translation filter to the configuration passed from config.yml file. Usage: # app/config/config.yml date: enabled: true configs: buttonText: mydate_jquery_text # message.en.yml mydate_jquery_text: "Select a Date" Hope this will be useful. --- Resources/views/Form/jquery_layout.html.twig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Resources/views/Form/jquery_layout.html.twig b/Resources/views/Form/jquery_layout.html.twig index 83927732..28c0ab99 100644 --- a/Resources/views/Form/jquery_layout.html.twig +++ b/Resources/views/Form/jquery_layout.html.twig @@ -100,6 +100,12 @@ }) %} {% endif %} + {% if configs.buttonText is defined %} + {% set configs = configs|merge({ + "buttonText": (configs.buttonText | trans) + }) %} + {% endif %} + {% if culture == "en" %} {% set culture = "en-GB" %} {% endif %}