[TYPO3-mvc] Localize Flashmessages and fluid form errors

Christian Kartnig office at hahnepeter.de
Sun Aug 28 11:26:08 CEST 2011


Hi!

I'm just facing the same problems and already found out some things:

The current error messages are hardcoded in Extbase Classes.

You can set the text of the flashmessage by overriding the method 
getErrorFlashMessage() in your Controller. What this method returns, 
will be output in the flashmessage, return false for no output.

The current best practice for localizing form validation errors is 
described in [1] by Sebastian Kurfürst. The problem I have with this 
approach is: The property name of the validated object is the argument 
name in my action, and not the type. So if I have two actions, e.g. one 
createAction($newPerson) and one editAction($person), I will need 
seperate error messages for the same object. Has anyone an idea how to 
get around this? It would be nice, if I could somehow determine the type 
of the object...

Hope I could help you.

Christian


[1] 
http://forge.typo3.org/projects/typo3v4-mvc/wiki/Translated_validation_error_messages_for_Fluid

Am 27.08.2011 18:33, schrieb Matthias Krappitz:
> Hi,
>
> I just created a small extension with the extension_builder where there
> is one model with 4 fields and 2 of them must be nonempty (the
> annotations for that in the model are set). If I save in the frontend
> without these 2 fields being filled out, I get a Flashmessage and fluid
> form errors using the appropriate Viewhelpers <f:flashMessages />
> ...<f:form.errors> ... {error.message} ... <f:if
> condition="{error.propertyName}"> <f:for each="{error.errors}"
> as="errorDetail"> {errorDetail.message} </f:for> ... </f:if> ...
> </f:form.errors>.
>
> So my question is, how do I change the text of the Flashmessage and of
> the Form Errors to something more human readable and how can I localize
> these messages? What is the best practice for that? And where exactly do
> the current standard texts come from? Are they hardcoded in extbase core
> somewhere?
>
> Best Wishes
>
> Matthias Krappitz
> w. www.aemka.de



More information about the TYPO3-project-typo3v4mvc mailing list