Reputation: 53
I want to add language localization module in Laravel.
The language should work on user level and not system level.
Every logged in user can choose their language and throughout the system language will change for this particular user.
I have found articles on how to change on system level in Laravel config file but i want this change to happen on user level
Upvotes: 0
Views: 211
Reputation: 33186
You can set the language for each request by calling the function \App::setLocale('en');
.
I put this in the AppServiceProvider
so the language is set for each user before loading of the page is started.
You could also create a middleware that takes care of this, wich would probably be an even better solution.
Upvotes: 1