Fixes #6182 -- Add html "lang" attribute.
This commit is contained in:
parent
f4cfb7c59d
commit
5464c0db6c
|
@ -61,6 +61,14 @@ enum SupportedLocales: string
|
|||
return self::stripLocaleEncoding($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The first two characters of the locale (for HTML `lang` attribute).
|
||||
*/
|
||||
public function getHtmlLang(): string
|
||||
{
|
||||
return strtolower(substr($this->value, 0, 2));
|
||||
}
|
||||
|
||||
public function register(Environment $environment): void
|
||||
{
|
||||
// Skip translation file reading for default locale.
|
||||
|
|
|
@ -18,7 +18,7 @@ $title ??= null;
|
|||
$header ??= null;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html data-theme="<?= $customization->getTheme()->value ?>">
|
||||
<html lang="<?= $customization->getLocale()->getHtmlLang() ?>" data-theme="<?= $customization->getTheme()->value ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<!DOCTYPE html>
|
||||
<?php
|
||||
/**
|
||||
* @var League\Plates\Template\Template $this
|
||||
|
@ -16,7 +15,9 @@
|
|||
$title ??= null;
|
||||
$hide_footer ??= false;
|
||||
?>
|
||||
<html data-theme="<?= $customization->getPublicTheme()->value ?>">
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= $customization->getLocale()->getHtmlLang() ?>"
|
||||
data-theme="<?= $customization->getPublicTheme()->value ?>">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
|
Loading…
Reference in New Issue