Php Laravel 5.6内容不可用的翻译

Php Laravel 5.6内容不可用的翻译,php,laravel,themes,translate,Php,Laravel,Themes,Translate,我想在主文件之外的另一个文件中使用translate(我有一些内容的文件,该文件由主文件扩展),但它不起作用。你知道为什么吗?主题url(“路径”)也存在同样的问题 在主文件中,我有: @php App::setLocale('en'); Theme::Set('mobile'); @endphp head... <body> @yield('content') </body> @php App::setLocale('en'); 主题::Set

我想在主文件之外的另一个文件中使用translate(我有一些内容的文件,该文件由主文件扩展),但它不起作用。你知道为什么吗?主题url(“路径”)也存在同样的问题

在主文件中,我有:

@php
    App::setLocale('en');
    Theme::Set('mobile');
@endphp
head...
<body>
    @yield('content')
</body>
@php
App::setLocale('en');
主题::Set('mobile');
@endphp
头。。。
@产量(‘含量’)
在扩展文件中:

@extends('main file')

@section('content')
    <img src="{{ theme_url('img/logo.png') }}">
    <span>{{ __('lang.title') }}</span>
@endsection
@extends('main file'))
@节(“内容”)
{{{{('lang.title')}
@端部

当我将@yield('content')替换为@include时,所有内容都将正常工作(使用author igaster切换主题)

我认为问题在于

@extends('main file')

@section('content')
    <img src="{{ theme_url('img/logo.png') }}">
    <span>{{ __('lang.title') }}</span>
@endsection
@extends('main file'))
@节(“内容”)
{{{{('lang.title')}
@端部
此代码首先执行,然后放入主文件 因此,在此文件中,区域设置不是“en”

试试这个

@extends('main file')

App::setLocale('en');
Theme::Set('mobile');

@section('content')
    <img src="{{ theme_url('img/logo.png') }}">
    <span>{{ __('lang.title') }}</span>
@endsection
@extends('main file'))
App::setLocale('en');
主题::Set('mobile');
@节(“内容”)
{{{{('lang.title')}
@端部

谢谢,当我在extend之前编写主题集和语言集时,一切都会正常工作