Laravel更改区域设置不起作用 [英] Laravel change locale not working
本文介绍了Laravel更改区域设置不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用语言下拉列表,包括英语和荷兰语.
I am using a dropdown lists for the languages, consisting of english and dutch.
<form class="" action="{{url('/locale')}}" method="post">
Locale:
<select class="" name="locale" onchange="this.form.submit()">
<option value="en" >English</option>
<option value="du" >Dutch</option>
</select>
</form>
然后这是我的routes.php,
Then this is my routes.php,
Route::post('/locale', function(){
\App::setLocale(Request::Input('locale'));
return redirect()->back();
});
它不起作用.
在我的项目中,路径是这样的
In my project, the path is like this
resources/
/du
navigation.php
/en
/navigation.php
来自荷兰语(du)'navigation.php'
From the Dutch(du) 'navigation.php'
<?php
return [
"home" => 'Home-test-dutch',
];
以及英文版的"navigation.php"
and for the English(en) 'navigation.php'
<?php
return [
"home" => 'Home',
];
推荐答案
我从本文感谢那些贡献非持久"一词的人
Thanks to the people who contributed the word 'non persistent'
这篇关于Laravel更改区域设置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文