Bläddra i källkod

Merge pull request #3409 from core23/batch-trans

Added translation domain to batchActions
Oskar Stark 9 år sedan
förälder
incheckning
7413b41c4e

+ 3 - 2
Admin/Admin.php

@@ -1158,8 +1158,9 @@ abstract class Admin implements AdminInterface, DomainObjectInterface
 
         if ($this->hasRoute('delete') && $this->isGranted('DELETE')) {
             $actions['delete'] = array(
-                'label'            => $this->trans('action_delete', array(), 'SonataAdminBundle'),
-                'ask_confirmation' => true, // by default always true
+                'label'              => 'action_delete',
+                'translation_domain' => 'SonataAdminBundle',
+                'ask_confirmation'   => true, // by default always true
             );
         }
 

+ 2 - 1
Resources/doc/reference/batch_actions.rst

@@ -37,7 +37,8 @@ merges them onto a single target item. It should only be available when two cond
           $this->hasRoute('delete') && $this->isGranted('DELETE')
         ) {
             $actions['merge'] = array(
-                'label' => $this->trans('action_merge', array(), 'SonataAdminBundle'),
+                'label' => 'action_merge',
+                'translation_domain' => 'SonataAdminBundle'
                 'ask_confirmation' => true
             );
 

+ 1 - 1
Resources/views/CRUD/base_list.html.twig

@@ -144,7 +144,7 @@ file that was distributed with this source code.
 
                                             <select name="action" style="width: auto; height: auto" class="form-control">
                                                 {% for action, options in batchactions %}
-                                                    <option value="{{ action }}">{{ options.label }}</option>
+                                                    <option value="{{ action }}">{{ options.label|trans({}, options.translation_domain|default(admin.translationDomain)) }}</option>
                                                 {% endfor %}
                                             </select>
                                         {% endblock %}