Laravel Lang通过邮政路线重置英语
因此,这是我的问题,我可以将本地化与Laravel一起使用。我一直在Get Route上使用它,我的后路线出现了问题。例如,我在注册页面上使用法语,当我单击寄存器时,一旦我输入控制器,该语言将重置为英语,但不得重置,因为我的控制器应该返回带有视图文字,因此该观点应该以正确的语言。我很想通过URL参数通过lang,但是由于这是我不能的帖子,因此我不能使用get,因为它是注册形式。事情是在我的路线上,我将lang设置为lang已经是法语,因为它已经是法语,从我访问注册页面时,它应该像lang ='fr'一样它将lang置于法语,将其重置为英语后第二。我已经陷入困境了一段时间,我看不到解决方案,有人可以帮我吗?
这是我的“法语”注册表格:
这是我的控制器返回的视图(应该写入'fr'not'en'):
预先感谢您的帮助和时间!
So here is my problem, I'm able to use Localization with Laravel. I've been using it on GET route, the problem occur with my POST route. For example, I'm in french on my registration page, when I click on register, once I enter my controller, the language is reset to english, but it must not be reset, because my controller is supposed to return a view with a text, so this view is supposed to be in the right language. I tought I could pass the lang through URL parameter, but since it is a POST I cannot and I must not use GET because it's a registration form. The thing is in my route I set the lang to what the lang is already, since it is already in french, from when I accessed the registration page, it should something like lang = 'fr', but no the program act like each time it set the lang to french, to second after it reset it to english. I've been stuck on this for a while and I cannot see the solution, can someone help me ?
Here is my 'french' registration form:
Here is the route 'register' (When you click on register/inscription):
Here is a part of my controller:
Here is the view my controller returns (It is supposed to be written 'fr' not 'en'):
Thanks in advance for your help and your time !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案,现在当我输入一个喜欢注册页面的页面时,我会这样做
以及在单击寄存器/铭文时触发的功能中,我在开始时添加了此功能
I've found the solution, now when I enter a page like to registration page I do this
And in the function that is triggered when clicking register/inscription I added this at the beginning