[FLOW3-general] Flash messages internationalization.
Steffen Wickham
steffen at gaming-inc.de
Fri Jan 4 13:56:57 CET 2013
Hello again Sergio,
as far as I know, there is no translation support for the FlashMessage
ViewHelper as all error messages/thrown exceptions of Flow are hardcoded
in english.
I've don't tested it but you could try to get translation by label in
your for part like this:
<f:flashMessages as="flashMessages">
<f:for each="{flashMessages}" as="flashMessage">
<div class="alert-box success">
<f:translate locale="{lang}">{flashMessage}</f:translate>.
<a href="" class="close">×</a>
</div>
</f:for>
</f:flashMessages>
All you need is to copy the original mesage shown in your alert box to
your XLIFF file as <source> and provide a proper <target> translation.
If you set the FlashMessage items by yourself, create a new variable of
type \TYPO3\Flow\I18n\Translator in your class and you can use
translation by the following line:
$this->translator->translateById($labelid, $arguments, $quantity,
$language, $source, $package);
Would be nice, if you could tell me (or us) if it's work.
Greetings
Steffen
Am 04.01.2013 12:24, schrieb Sergio:
> Hi,
>
> I'm trying to translate my "flash messages" in my extension.
>
> 1. I added unit entries and translations for every message.
>
> 2. I add flash message from my controller:
>
> eg:
>
> $message = 'Successfully logged in';
> $this->addFlashMessage($message);
>
> 3. I added the "lang" attribute to <f:flashMessages> viewhelper in my view:
>
> eg:
>
>
> <f:flashMessages lang="{lang}" as="flashMessages">
> <f:for each="{flashMessages}" as="flashMessage">
> <div class="alert-box success">
> {flashMessage}.
> <a href="" class="close">×</a>
> </div>
> </f:for>
> </f:flashMessages>
>
> Only entries in the default language are shown. "lang" contains the
> language of the user, which is not the same as the default language.
>
> Am I missing something?
>
> Thanks in advance,
> Sergio
> _______________________________________________
> FLOW3-general mailing list
> FLOW3-general at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/flow3-general
More information about the FLOW3-general
mailing list