Page MenuHomePhabricator

Use BCP 47 conform language codes for the HTML attribute lang
Closed, ResolvedPublic

Description

The value of the HTML attribute [[ https://www.w3.org/TR/html5/dom.html#the-lang-and-xmllang-attributes | lang ]] must be a valid BCP 47 language tag.

The HTML validation fails because of invalid language codes: https://validator.w3.org/nu/?doc=https://www.wikidata.org/wiki/Q5296

Event Timeline

Fomafix raised the priority of this task from to Low.
Fomafix updated the task description. (Show Details)
Fomafix added a subscriber: Fomafix.
Lydia_Pintscher added a subscriber: Lydia_Pintscher.

Realistically it seems we're not getting to it since it hasn't been touched in two years. Sorry :( Feel free to reopen with a patch.

Fomafix updated the task description. (Show Details)

Reopened. The HTML fails the HTML validation because of invalid lang attributes. This is not an invalid bug.

T106367 is a related task for other lang attributes in MediaWiki core.

There's a patch for proper BCP-47 validity conversion in core: I807dd55d49e9bd19443329231326a5b0d3e6c453

Change 442200 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Ensure LanguageCode::bcp47() returns a valid BCP-47 language code

https://gerrit.wikimedia.org/r/442200

Change 442200 merged by jenkins-bot:
[mediawiki/core@master] Ensure LanguageCode::bcp47() returns a valid BCP 47 language code

https://gerrit.wikimedia.org/r/442200

Jdforrester-WMF assigned this task to cscott.
Jdforrester-WMF added a subscriber: Jdforrester-WMF.

Now fixed in Beta Cluster Wikidata: https://validator.w3.org/nu/?doc=https%3A%2F%2Fwikidata.beta.wmflabs.org%2Fwiki%2FQ470764

Remaining error is for the wikibase-aliasesview-list UL's dir being set to ''; not sure if that's filed?

Reopened. Validation of https://www.wikidata.org/wiki/Q5296 (https://validator.w3.org/nu/?doc=https://www.wikidata.org/wiki/Q5296) still fails because for the lang and the hreflang attributes LanguageCode::bcp47 is not applied.

Change 447054 had a related patch set uploaded (by Fomafix; owner: Fomafix):
[mediawiki/extensions/Wikibase@master] Apply Language::bcp47 for lang and hreflang attributes

https://gerrit.wikimedia.org/r/447054

Change 460038 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/core@master] Ensure LanguageCode::bcp47() returns a valid BCP 47 language code

https://gerrit.wikimedia.org/r/460038

Change 447054 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] Apply LanguageCode::bcp47 for lang and hreflang attributes

https://gerrit.wikimedia.org/r/447054

Change 460038 merged by jenkins-bot:
[mediawiki/core@master] Ensure LanguageCode::bcp47() returns a valid BCP 47 language code

https://gerrit.wikimedia.org/r/460038