Base solution for your next web application
Open Closed

Login - Change language, update html tag, lang attribute #11713


0
deltavision created

Hi,

v11.2.1 MVC .NET Core

We wish to update the lang attribute of the html tag, based on the selected language. But can not figure out where to do this.

It should be set when entering the page and when changing the language


2 Answer(s)
  • 0
    ismcagdas created
    Support Team

    Hi,

    You can inject ILanguageManager to related _Layout.cshtml file and get current language using LanguageManager.CurrentLanguage.

    @inject ILanguageManager LanguageManager
    
    <html lang="@LanguageManager.CurrentLanguage.Name">
     <!-- OTHER CODE BLOCKS -->
    </html>
    
  • 0
    deltavision created

    Hi @ismcagdas,

    works perfectly - thank you