In my view I have
<p>{{ trans('mission-vision-page.mission-description') }}</p>
I've put a block of text in my language file, but I want to maintain the new lines. I've tried:
1.
return ['mission-description' => 'line 1 <br /> line 2']
2.
return ['mission-description' => 'line 1 \n line 2']
3.
$newLine = '<br />';
return ['mission-description' => 'line 1 ' . $newLine . ' line 2']
I know probably there's a better way to accomplish this, but in my en.php file can I add new lines?
nl2br — Inserts HTML line breaks before all newlines in a string. Laravel helper provide many functionalities and you can use e Laravel helper function to purify your html before showing line breaks. You need to do the escaping first using e() and then after apply nl2br() function.
You can try: {!! 'first line <br> second line' !!}
use {!! !!}
instead of {{ }}
and <br/>
tag in you message
<p>{!! trans('mission-vision-page.mission-description') !!}</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With