TASK: Add translated flash message after record was edited

This commit is contained in:
Daniel Siepmann 2018-11-05 09:19:45 +01:00
parent 8c13a05cb4
commit fd69c91652
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
3 changed files with 10 additions and 1 deletions

View file

@ -22,6 +22,7 @@ namespace Workshop\ExampleExtension\Controller;
*/ */
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use Workshop\ExampleExtension\Domain\Model\Address; use Workshop\ExampleExtension\Domain\Model\Address;
use Workshop\ExampleExtension\Domain\Repository\AddressRepository; use Workshop\ExampleExtension\Domain\Repository\AddressRepository;
@ -55,7 +56,10 @@ class AddressController extends ActionController
$this->addressRepository->update($address); $this->addressRepository->update($address);
$this->addFlashMessage( $this->addFlashMessage(
$address->getCompanyName() . ' was updated.', LocalizationUtility::translate('flashSuccess', 'ExampleExtension', [
'companyName' => $address->getCompanyName(),
'street' => $address->getStreet(),
]),
'Update successfully' 'Update successfully'
); );
$this->redirect('index'); $this->redirect('index');

View file

@ -30,6 +30,10 @@
<trans-unit id="error.address.zip.1221565130" xml:space="preserve"> <trans-unit id="error.address.zip.1221565130" xml:space="preserve">
<source>Please provide a valid ZIP consisting of 5 digits.</source> <source>Please provide a valid ZIP consisting of 5 digits.</source>
</trans-unit> </trans-unit>
<trans-unit id="flashSuccess" xml:space="preserve">
<source>Update des Datensatzes %1$s war Erfolgreich.</source>
</trans-unit>
</body> </body>
</file> </file>
</xliff> </xliff>

View file

@ -1,3 +1,4 @@
<f:flashMessages />
<f:for each="{addresses}" as="address"> <f:for each="{addresses}" as="address">
<h3>{address.companyName}</h3> <h3>{address.companyName}</h3>
<address> <address>