Reputation: 125
I'm trying to display a translated word on the blade in a laravel application.
my language variable is "texts"
and I have the following on my blade
@foreach($permission as $value)
<li><label>{{ Form::checkbox('permission[]', $value->id, false, array('class' => 'name')) }}
{{ ('$value->name') }}</label></li>
<br/>
@endforeach
I'm trying to translate this
{{ ('$value->name') }}
This should give a result like, user-edit, user-view...
In my language file, I have the translated texts for those outputs.
I've tried this on my blade
{{ __('texts.$value->name') }}
But it just only printing
texts.$value->name
What is the correct way of translating this,
{{ ('$value->name') }}
Upvotes: 0
Views: 1666
Reputation:
You are using single quotes in {{ __('texts.$value->name') }}
. Variables don't expand inside single quotes. Concatenate the two strings instead:
{ __('texts.' . $value->name) }}
Upvotes: 1