Project

General

Profile

Actions

Bug #11129

closed

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

Added by Dries Mys almost 3 years ago. Updated 4 days ago.

Status:
Closed
Priority:
Low
Target version:
Start date:
12/04/2022
Due date:
% Done:

100%

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);
Actions #1

Updated by Matthias Van Ceulebroeck 7 months ago

  • Target version set to 4.12.1

Hello Dries,

I have to admit I lost track of this ticket. The prompt on the related (#12148) got me to view this again.
Your proposal should fix the attribute for bots.

Actions #2

Updated by Romain Mardulyn 5 months ago

  • Status changed from New to InProgress
  • Assignee set to Romain Mardulyn
Actions #3

Updated by Romain Mardulyn 5 months ago

  • Status changed from InProgress to Review
  • Assignee deleted (Romain Mardulyn)
Actions #4

Updated by Matthias Van Ceulebroeck 3 months ago

  • Assignee set to Matthias Van Ceulebroeck
Actions #5

Updated by Matthias Van Ceulebroeck 5 days ago

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn
  • % Done changed from 0 to 100
Actions #6

Updated by Matthias Van Ceulebroeck 5 days ago

  • Status changed from Implemented @Emweb to Implemented @Test
Actions #7

Updated by Matthias Van Ceulebroeck 4 days ago

  • Status changed from Implemented @Test to Closed
Actions

Also available in: Atom PDF