Ad

Localisation Of Page Titles With Laravel

I have the main page where I yield the title like this:

<title>@yield('title')</title>

Now I want to use this on my pages, but I want it to be localized, so I have the lang folder with two languages - en & ru, inside of which I have a file called 'titles.php', where I keep my titles.

The problem is that if I try to use something like

@section('title', {{__('titles.faq')}})

on my page it throws an error immediately. Is there any way to do that? What am I doing wrong?

Ad

Answer

There is no need to use the curly brackets in a blade function, they are evaluated as plain php code:

@section('title', __('titles.faq'))
Ad
source: stackoverflow.com
Ad