Skip to content

Commit

Permalink
Fixed SavedFilters list translations (#3)
Browse files Browse the repository at this point in the history
Co-authored-by: Yann Eugoné <[email protected]>
  • Loading branch information
yann-eugone and yann-eugone authored Oct 10, 2023
1 parent 09ec32a commit 8dd5d3d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 30 deletions.
1 change: 1 addition & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'label' => 'saved_filters.name',
'model_class' => SavedFilters::class,
'controller' => SavedFiltersController::class,
'label_translator_strategy' => 'sonata.admin.label.strategy.underscore',
])
->args([
service(SavedFiltersOwnerAccessorInterface::class),
Expand Down
57 changes: 27 additions & 30 deletions src/Admin/SavedFiltersAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,41 +107,38 @@ protected function configureActionButtons(array $buttonList, string $action, ?ob

protected function configureListFields(ListMapper $list): void
{
$list
->add('name')
->add('adminClass')
->add('filters', null, ['inline' => false])
->add('public')
;
$list->add('name', null, ['label' => 'saved_filters.field.name']);
$list->add('adminClass', null, ['label' => 'saved_filters.field.admin_class']);
$list->add('filters', null, ['label' => 'saved_filters.field.filters', 'inline' => false]);
$list->add('public', null, ['label' => 'saved_filters.field.public']);

if ($this->isGranted('PROTECT')) {
$list->add('protected');
$list->add('protected', null, ['label' => 'saved_filters.field.protected']);
}

$list
->add(
'_action',
'actions',
[
'actions' => [
'share' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_share.html.twig',
],
'protect' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_protect.html.twig',
],
'unprotect' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_unprotect.html.twig',
],
'subscribe' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_subscribe.html.twig',
],
'unsubscribe' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_unsubscribe.html.twig',
],
$list->add(
'_action',
'actions',
[
'label' => 'saved_filters.field._action',
'actions' => [
'share' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_share.html.twig',
],
'protect' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_protect.html.twig',
],
'unprotect' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_unprotect.html.twig',
],
'subscribe' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_subscribe.html.twig',
],
'unsubscribe' => [
'template' => '@PrestaSonataSavedFilters/saved_filters/list_action_unsubscribe.html.twig',
],
],
)
;
],
);
}
}
4 changes: 4 additions & 0 deletions translations/PrestaSonataSavedFiltersBundle.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="breadcrumb.link_saved_filters_list">
<source>breadcrumb.link_saved_filters_list</source>
<target>Saved filters list</target>
</trans-unit>
<trans-unit id="saved_filters.action.create">
<source>saved_filters.action.create</source>
<target>Save current state</target>
Expand Down
4 changes: 4 additions & 0 deletions translations/PrestaSonataSavedFiltersBundle.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="breadcrumb.link_saved_filters_list">
<source>breadcrumb.link_saved_filters_list</source>
<target>Liste des filtres pré-enregistrés</target>
</trans-unit>
<trans-unit id="saved_filters.action.create">
<source>saved_filters.action.create</source>
<target>Enregistrer l'état actuel</target>
Expand Down

0 comments on commit 8dd5d3d

Please sign in to comment.