what are you using the locale on a api request, validation messages? anyhow each user can have a preferred locale on the DB or you can send the locale via a header.
Oct 2, 2023
2
Level 1
Persist locale in both web and api routes
I store my locale in a session, every request I run a Localization middleware to set the locale stored in the session.
This works fine between web requests, but I have an api request which validates fields on a form and returns a list of validation messages. Of course, the session which was set in the web routes cannot be known by the api routes, so I cannot set locale using the same middleware.
How would you suggest persisting the locale so it can be used both by web and api routes?
Please or to participate in this conversation.