Hello Everyone,
Today I will share with you how do add multi language to a website that was developed in laravel, my version is 5.6 but it will wor...
For further actions, you may consider blocking this person and/or reporting abuse
TL;DR: how to fix a potential "too many redirects" error calling
redirect()->back()
Nice article, thanks! Although, if you enter the locale URL directly on the browser URL bar, you could get a "too many redirects" error.
The underlaying problem is, in that particular case, you don't have a "back" URL (as the current URL is the first in the history stack, so Laravel returns the current URL when you call
redirect()->back()
)You can see it yourself by adding the following:
A quick fix would be to only call the
back()
method, if the target URL is different than the current one. You could achieve this by using the following snippet:Cheers!
when i run this code i got an error page not found. the url should be like this 127.0.0.1:8000/localisation/create but when i change the language the url become 127.0.0.1:8000/localisation/lang/en.
thanks so much for this great description. i really appreciated it works for me just super fine.
Thank you for your support :)
how can i add language to url
example example.com/pt-BR/content or example.com/en/content
hey @filippe-felix did you solved this ?
Hi, no =(
laraveldaily.com/multi-language-ro...
youtube.com/watch?v=KqzGKg8IxE4
this will do it :)
Finally its fixed
Yes , I agree with you, if possible try to explain how to proceed so we all can know. Thank you.
Comment faire pour les articles qui viennent de la base de donnรฉe, pour qu'ils soient rendu en franรงais et anglais svp ?.
One way to do so is for example if you have a "posts" table with column : "id, title_en, title_fr, content_en, content_fr *" you can use if/else statement together with "app()->getLocale()*".
Or:
But best method is to set a custom If Statement!
1: Add in your AppServiceProvider:
use Illuminate\Support\ServiceProvider;
2: In your views:
@lang('en')
//
@elselang('fr')
//
@else
//
@endlang
thank u so much
This is exaclty what I want. Other sites aren't making good explanation about this. Thanks.
thank you very much
If you could share about dynamic multi-language from MySQL, it really appriciate.
Thanks!
I tried this and now I got the error as seen in the added screenshot
thank you.
does a with href attr work? as :
Hey, could somebody explain how to fix that? Thanks!!!
Hello, this is good for SEO ??
Does it also suitable for Laravel 6? Did someone try to do it?
yeah i tried with laravel 7 :P