From fd69c91652720c89773786c78f9ff920bd0de295 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 5 Nov 2018 09:19:45 +0100 Subject: [PATCH] TASK: Add translated flash message after record was edited --- .../Classes/Controller/AddressController.php | 6 +++++- .../Resources/Private/Language/locallang.xlf | 4 ++++ .../Resources/Private/Templates/Address/Index.html | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CodeExamples/localPackages/example_extension/Classes/Controller/AddressController.php b/CodeExamples/localPackages/example_extension/Classes/Controller/AddressController.php index d6fde3f..1d75f28 100644 --- a/CodeExamples/localPackages/example_extension/Classes/Controller/AddressController.php +++ b/CodeExamples/localPackages/example_extension/Classes/Controller/AddressController.php @@ -22,6 +22,7 @@ namespace Workshop\ExampleExtension\Controller; */ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use Workshop\ExampleExtension\Domain\Model\Address; use Workshop\ExampleExtension\Domain\Repository\AddressRepository; @@ -55,7 +56,10 @@ class AddressController extends ActionController $this->addressRepository->update($address); $this->addFlashMessage( - $address->getCompanyName() . ' was updated.', + LocalizationUtility::translate('flashSuccess', 'ExampleExtension', [ + 'companyName' => $address->getCompanyName(), + 'street' => $address->getStreet(), + ]), 'Update successfully' ); $this->redirect('index'); diff --git a/CodeExamples/localPackages/example_extension/Resources/Private/Language/locallang.xlf b/CodeExamples/localPackages/example_extension/Resources/Private/Language/locallang.xlf index 53b85c8..9599d4f 100644 --- a/CodeExamples/localPackages/example_extension/Resources/Private/Language/locallang.xlf +++ b/CodeExamples/localPackages/example_extension/Resources/Private/Language/locallang.xlf @@ -30,6 +30,10 @@ Please provide a valid ZIP consisting of 5 digits. + + + Update des Datensatzes %1$s war Erfolgreich. + diff --git a/CodeExamples/localPackages/example_extension/Resources/Private/Templates/Address/Index.html b/CodeExamples/localPackages/example_extension/Resources/Private/Templates/Address/Index.html index d8869da..789c4c5 100644 --- a/CodeExamples/localPackages/example_extension/Resources/Private/Templates/Address/Index.html +++ b/CodeExamples/localPackages/example_extension/Resources/Private/Templates/Address/Index.html @@ -1,3 +1,4 @@ +

{address.companyName}