Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Current Language and Tenant default Language - Angular #4731


User avatar
0
mmukkara created

Hi,

I need to find tenant default language and Current Language. I think

abp.localization.currentLanguage.name

gives me current language. How do I get tenant default language in angular.

Thanks


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

    On Angular after user signs in, an http request is being made to <a class="postlink" href="http://mydomain.com/AbpUserConfiguration/GetAll">http://mydomain.com/AbpUserConfiguration/GetAll</a> you get some basic information from this request's response.

    And you can get the current language with the JS function below

    var getTenantDefaultLanguage = function() {
    
    
        for (var i = 0; i < abp.localization.languages.length; i++) {
            var language = abp.localization.languages[i];
            if (language.isDefault) {
                return language;
            }
        }
    
        return null;
    
    }
    
  • User Avatar
    0
    mmukkara created

    Thank you @alper.

  • User Avatar
    0
    alper created
    Support Team

    I hope it helps ;)