I want to use translate in another file than main file(file where i have some content and this file is extended by main file), but it is not working. Do you know anyone why? The same problem is with theme_url('path').
in main file i have:
@php
App::setLocale('en');
Theme::Set('mobile');
@endphp
head...
<body>
@yield('content')
</body>
and in extended file:
@extends('main file')
@section('content')
<img src="{{ theme_url('img/logo.png') }}">
<span>{{ __('lang.title') }}</span>
@endsection
When i replaced @yield('content') by @include, all will be working(switching theme using from author igaster)
I think the problem is that
@extends('main file')
@section('content')
<img src="{{ theme_url('img/logo.png') }}">
<span>{{ __('lang.title') }}</span>
@endsection
this code executed first and then put in main file so in this file locale is not 'en'
try this
@extends('main file')
App::setLocale('en');
Theme::Set('mobile');
@section('content')
<img src="{{ theme_url('img/logo.png') }}">
<span>{{ __('lang.title') }}</span>
@endsection
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.