Project

General

Profile

Bug #11129

html lang attribute is not correctly set in plain html mode (including bot mode)

Added by Dries Mys 2 months ago.

Status:
New
Priority:
Low
Assignee:
-
Target version:
-
Start date:
12/04/2022
Due date:
% Done:

0%

Estimated time:

Description

Inside WebRenderer::setPageVars, the html lang attribute is always set to "en":

  if (session_.env().agentIsIE())
    page.setVar("HTMLATTRIBUTES",
        "xmlns:v=\"urn:schemas-microsoft-com:vml\""
        " lang=\"en\" dir=\"ltr\"" + htmlAttr);
  else
    page.setVar("HTMLATTRIBUTES", "lang=\"en\" dir=\"ltr\"" + htmlAttr);

When ajax is not available, this attribute will never be updated to its correct value.

Solution

Use the WApplication::locale if the app is already available (which is the case in plain html mode):

  if (session_.env().agentIsIE())
    page.setVar("HTMLATTRIBUTES",
        "xmlns:v=\"urn:schemas-microsoft-com:vml\""
                " lang=\""+(app ? app->locale().name() : "en")+"\" dir=\"ltr\"" + htmlAttr);
  else
    page.setVar("HTMLATTRIBUTES", "lang=\""+(app ? app->locale().name() : "en")+"\" dir=\"ltr\"" + htmlAttr);

No data to display

Also available in: Atom PDF