Project

General

Profile

Actions

Bug #11129

closed
DM RM

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

Bug #11129: html lang attribute is not correctly set in plain html mode (including bot mode)

Added by Dries Mys almost 4 years ago. Updated 11 months 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);

MV Updated by Matthias Van Ceulebroeck over 1 year ago Actions #1

  • 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.

RM Updated by Romain Mardulyn over 1 year ago Actions #2

  • Status changed from New to InProgress
  • Assignee set to Romain Mardulyn

RM Updated by Romain Mardulyn over 1 year ago Actions #3

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

MV Updated by Matthias Van Ceulebroeck about 1 year ago Actions #4

  • Assignee set to Matthias Van Ceulebroeck

MV Updated by Matthias Van Ceulebroeck 11 months ago Actions #5

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

MV Updated by Matthias Van Ceulebroeck 11 months ago Actions #6

  • Status changed from Implemented @Emweb to Implemented @Test

MV Updated by Matthias Van Ceulebroeck 11 months ago Actions #7

  • Status changed from Implemented @Test to Closed
Actions

Also available in: PDF Atom