Hi,
In our project, we use the AuthServer provided by ABP (configured as an MVC and decoupled project) for user authentication. After a successful login, the user is redirected to our custom-developed UI application. This UI consists of web and mobile clients, which communicate with the backend developed using ABP’s infrastructure (ApiHost).
What would be the best approach to transfer the language selected by the user during login on the AuthServer to both the UI (web and mobile) and the ApiHost layers?
Is there an ABP-recommended method or best practice to achieve this? The goal is to maintain the user's language preference consistently across all layers of the application (UI and API).
The diagram I added may help:
Thank you in advance for your help!
3 Answer(s)
-
0
Hi,
ABP doesn't keep any user language data in the database. They kept at client-side. If you deploy multiple applications in different domains, so they cannot share cookies even they're subdomains of the same domain. (Yes there is some ways to do it but by default it's not shared).
So, it's client-specified feature. If you want to keep this kind of settings (language, theme(dark/light)) in the databse/server-side and sync across all the clients, you may use settings feature of the ABP. Settings feature allows you to define a settings for Application-wide, for a tenant, for a user etc.
https://abp.io/docs/latest/framework/infrastructure/settings
You can define a setting for language, and set it for each users, then use that settting to define user's languages
-
0
Thanks for the comment.
-
0
You can also check Setting Management module:https://abp.io/docs/latest/modules/setting-management
It implements tenant/user/application-wide settings. You can just inject
ISettingManager
and useSetForUserAsync()
method to set a setting for a specific user