Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed SavedFilters list translations #3

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading