Laravel Lang通过邮政路线重置英语

发布于 2025-01-21 13:00:50 字数 1308 浏览 0 评论 0原文

因此,这是我的问题,我可以将本地化与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:

enter image description here
enter image description here

Here is the route 'register' (When you click on register/inscription):
enter image description here

Here is a part of my controller:
enter image description here

Here is the view my controller returns (It is supposed to be written 'fr' not 'en'):
enter image description here

Thanks in advance for your help and your time !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

杯别 2025-01-28 13:00:50

我找到了解决方案,现在当我输入一个喜欢注册页面的页面时,我会这样做

以及在单击寄存器/铭文时触发的功能中,我在开始时添加了此功能

I've found the solution, now when I enter a page like to registration page I do this
enter image description here

And in the function that is triggered when clicking register/inscription I added this at the beginning
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文