Another example of how we can add a language selector to our application is by using sessions and a DB table to store the user's preferred language.
This example will not use a URL to determine the language which will allow us to use the same URL for all languages.

Setup
Our setup process for Database stored language selection will touch these things:
- Configuration: Adding a language list to our configuration - this will be used to display the language selector
-
DB Structure: Creating a new field on the
userstable calledlanguage - Controller: Create a controller that will handle the language change
- Middleware: Add a middleware to handle language settings based on user's preferences
- Views: Adding a language selector to our views
- Routes: Adding a route that will allow us to change the language
Let's start with the configuration:...
I have followed the chapter several times, but I always have a problem
What problem exactly? The repository code is available, so maybe you can compare your code?
There seems to be an issue with the 'ChangeLanguageController'. The message says: "ChangeLanguageController not invokable: The controller class
ChangeLanguageControlleris not invokable. Did you forget to add the__invokemethod or is the controller's method missing in your routes file?" Hm.Hm, it seems that I forgot to add a use at the top. Please import the controller using:
and it will work!
It's OK for me thanks everyone