html_has_lang
<html>
elements must have alang
attribute, using a BCP 47 language tag.User impact: Serious
This rule supports the following configuration:
- TOML
- Shell
# The `lang` attribute must be present.html_has_lang = true# The `lang` attribute must match the configured language tag.html_has_lang = "en-US"# The `lang` attribute must match one of the configured language tags.html_has_lang = [ "en", "en-US",]
# The `lang` attribute must be present.curlylint --rule 'html_has_lang: true' .# The `lang` attribute must match the configured language tag.curlylint --rule 'html_has_lang: "en-US"' .# The `lang` attribute must match one of the configured language tags.curlylint --rule 'html_has_lang: ["en", "en-US"]' .
#
Success- TOML
- Shell
<!-- Good: Check lang is present --><!-- html_has_lang = true --><html lang="en"></html><!-- Good: Correct language --><!-- html_has_lang = "en" --><html lang="en"></html><!-- Good: Correct language, multiple options --><!-- html_has_lang = [ "en", "en-GB",] --><html lang="en"></html>
<!-- Good: Check lang is present --><!-- curlylint --rule 'html_has_lang: true' . --><html lang="en"></html><!-- Good: Correct language --><!-- curlylint --rule 'html_has_lang: "en"' . --><html lang="en"></html><!-- Good: Correct language, multiple options --><!-- curlylint --rule 'html_has_lang: ["en", "en-GB"]' . --><html lang="en"></html>
#
Fail- TOML
- Shell
<!-- Bad: Missing --><!-- html_has_lang = true --><html></html><!-- Bad: Wrong language --><!-- html_has_lang = "en" --><html lang="fr"></html><!-- Bad: Wrong language, multiple options --><!-- html_has_lang = [ "en", "en-GB",] --><html lang="en-US"></html>
<!-- Bad: Missing --><!-- curlylint --rule 'html_has_lang: true' . --><html></html><!-- Bad: Wrong language --><!-- curlylint --rule 'html_has_lang: "en"' . --><html lang="fr"></html><!-- Bad: Wrong language, multiple options --><!-- curlylint --rule 'html_has_lang: ["en", "en-GB"]' . --><html lang="en-US"></html>