Open Closed

Transferring User's Selected Language from AuthServer to UI and API Layers #9316


User avatar
0
htavukcu created

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)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    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

  • User Avatar
    0
    htavukcu created

    Thanks for the comment.

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    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 use SetForUserAsync() method to set a setting for a specific user

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on June 13, 2025, 11:37