Base solution for your next web application
Open Closed

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


User avatar
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

Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    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>
    
    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    deltavision created

    Hi @ismcagdas,

    works perfectly - thank you

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)