[TYPO3-mvc] linebreaks from locallang.xml

Sebastian Schreiber me at schreibersebastian.de
Fri May 4 12:28:07 CEST 2012


Hi Dominic,
this can´t work because the \n gets never interpreted.
You could create your own nl2br ViewHelper and put something like that:

public function render() {
         $content = $this->renderChildren();
                 eval("\$content = \"$content\";");
                 return nl2br($content);
}

in the render-method.

But i would recommend just to press return in your locallang.xml file 
and you  should be fine:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<type>module</type>
<description>Language labels for the HTML5Videoplayer extension in the 
FRONTEND</description>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="ll_label">Text
in another line</label>
</languageKey>
</data>
</T3locallang>

Simple but effective.


Am 04.05.2012 05:26, schrieb Domi:
> Good day!
>
> Sorry for this small stupid question, but I am trying around and 
> couldn't find a quick solution. How do I display linebreaks with the 
> f:translate view helper?
>
> I tried:
>
> <f:format.nl2br>
> <f:translate key="mykey" />
> </f:format.nl2br>
>
> And inside of my language key I just wrote some text like:
>
> sometext somemore \n next line
>
> But the \n just getting displayed.
>
> What is the correct way to do this?
>
> Thanks!
>
> Dominic
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc


-- 
Sebastian Schreiber
(Medieninformatiker B.Sc.)
(TYPO3 Certified Integrator)

Schanzenstraße 27, Schlosserei 4
D-51063 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 217 / 5269 / 4675



More information about the TYPO3-project-typo3v4mvc mailing list