Setting translations domain
Closed this issue · 3 comments
Only working way which I found was to set label_translation_domain
for every field. Is it possible to set label_translation_domain
to all grid colums?
For example like:
/**
* Class UserGrid
*
* @package Nfq\Bundle\UserBundle\Grid
*/
class UserGrid extends BaseGridType
{
/**
* {@inheritDoc}
*/
public function buildGrid(GridBuilder $builder, array $options = [])
{
$builder
->addColumn('id', 'string', ['sortable' => true, 'label' => 'grid.id')
->addColumn('firstname', 'string', ['sortable' => true, 'label' => 'grid.firstname'])
->addColumn('lastname', 'string', ['sortable' => true, 'label' => 'grid.lastname']);
}
/**
* {@inheritdoc}
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(
[
'label_translation_domain' => 'User',
]
);
}
At the moment this is not possible, but it's a good idea! Unfortunately it requires quite a bit of refactoring to make something like this work. Currently it is only possible to have TypeExtensions for columns and actions, not for grids itself. This needs to be added first.
It's on my todo list, but it's not something I will be able to add on a very short notice.
Thanks for response :)
This has been implemented in prezent/grid 0.8.x and prezent/grid-bundle 0.4.x. Note that there are several backwards incompatibel changes in these latest versions. See https://github.com/Prezent/prezent-grid/blob/master/doc/upgrading.md