[TYPO3-mvc] linebreaks from locallang.xml

Nicole Cordes cordes at cps-it.de
Fri May 4 14:12:42 CEST 2012


Don't use eval for your case, because it's not necessary. You can simply use
CDATA statements in your locallang label and insert the br's on your own.


Best regards,
Nicole

-----Ursprüngliche Nachricht-----
Von: typo3-project-typo3v4mvc-bounces at lists.typo3.org
[mailto:typo3-project-typo3v4mvc-bounces at lists.typo3.org] Im Auftrag von
Sebastian Schreiber
Gesendet: Freitag, 4. Mai 2012 12:28
An: TYPO3 v4 MVC project
Betreff: Re: [TYPO3-mvc] linebreaks from locallang.xml

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-typo3v4m
> vc


--
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

_______________________________________________
TYPO3-project-typo3v4mvc mailing list
TYPO3-project-typo3v4mvc at lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list