Base solution for your next web application
Open Closed

User tenant default language when no localization cookie #8350


User avatar
0
ignasiclos created

I need to set the default culture to the tenant culture.

When it there is no cookie, it is using the browser culture. I've tried to read the cookie from a custom UserConfigurationController, but the cookies are always empty :

I've also tried to follow the default culture in Abp, and I've found that it is set in the CurrentCultureSetter class, that it is part of the Abp.Web project, that is build for framework 4.6 In my case I'm using .net core, so this method is not acually used.

So I cannot find a way to use the tenant default language. Thanks


3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Hava you read this document?

    How the Current Language is Determined (ASP.NET Core)

    https://aspnetboilerplate.com/Pages/Documents/Localization#how-the-current-language-is-determined

    AbpDefaultRequestCultureProvider (ABP's provider): If there is an default/application/tenant setting value for the language (named "Abp.Localization.DefaultLanguageName"), then use the setting's value.

    I suggest you use Abp.Localization.DefaultLanguageName for your tenants to set their default language.

  • User Avatar
    0
    ignasiclos created

    The tenants has their default language set correctly.

    What I need is that the application is served by default in the tenant default language, instead of the browser.

  • User Avatar
    0
    ignasiclos created

    I made it by inserting a new RequestCultureProvider :

    That returns the tenant default language when user is null and tenant is not null