How to define language attribute in <html> tag in kentico 9.

Karambir Sharma asked on September 7, 2017 12:50

How to define language attribute in

Correct Answer

Brenden Kehren answered on September 7, 2017 13:15

You can add this in your main master page layout.

<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        if (CurrentDocument != null)
        {            CMS.UIControls.ContentPage page= this.Page as CMS.UIControls.ContentPage;
            if (page != null)
            {
                string lang= CMS.Localization.LocalizationContext.CurrentCulture.CultureCode;
                page.XmlNamespace += " lang=\"" + lang + "\"";
            }
        }
    }
</script>
1 votesVote for this answer Unmark Correct answer

Recent Answers


Chetan Sharma answered on September 7, 2017 13:18 (last edited on September 7, 2017 13:18)

Brenden's answer is spot on. I will also add this line because sometime some of the tools give this error unless this tag is defined too.

page.XmlNamespace += " xml:lang=\"" + lang + "\"";

2 votesVote for this answer Mark as a Correct answer

Karambir Sharma answered on September 7, 2017 13:37

Thanks Brenden and chetan for the answer.

0 votesVote for this answer Mark as a Correct answer

Danielle Lukas answered on September 13, 2017 08:43

The class trait gives a method for arranging comparable components for introduction purposes. For instance, a HTML report may utilize the assignment class="notation" to show that all components with this class esteem are subordinate to the primary content of the archive. Custom Essay Writing Service. Such components may be assembled and exhibited as commentaries on a page as opposed to showing up in where they happen in the HTML source.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.