Base solution for your next web application
Open Closed

I need language selection from users who are not logged in. #4766


User avatar
0
affern created

Hi. How do I get language selection from users who are not logged in? I have created a public page for non-authenticated users and I need to show static content pages like "Help", "Cookies" and "Terms and Conditions" in the selected language. I have managed it to work for authenticated users, but I can't find the method in angular that get the language.


2 Answer(s)
  • User Avatar
    0
    alirizaadiyahsi created

    Hi @affern, you can check related code in account/language-switch.component.ts

    changeLanguage(language: abp.localization.ILanguageInfo) {
            abp.utils.setCookieValue(
                'Abp.Localization.CultureName',
                language.name,
                new Date(new Date().getTime() + 5 * 365 * 86400000), // 5 year
                abp.appPath
            );
    
            location.reload();
        }
    
  • User Avatar
    0
    affern created

    Thanks! It was this code for reading the cookie value I needed: abp.utils.getCookieValue("Abp.Localization.CultureName");