Page MenuHomePhabricator

Statements linking to forms and senses are missing a HTML lang attribute
Closed, ResolvedPublic5 Estimated Story Points

Description

Problem:
The values of Statements that link to Forms and Senses do not have language attributes associated with them in the HTML code. They should, like for links to Lexemes.

Example:

Values linking to a Sense: https://www.wikidata.org/wiki/Lexeme:L1#S1-P5972 (missing lang attribute)
Values linking to another Form: https://www.wikidata.org/wiki/Lexeme:L314351#F1-P8530 (missing lang attribute)
Values linking to another Lexeme: https://www.wikidata.org/wiki/Lexeme:L99#P5238 (correct with lang attribute)

BDD
GIVEN a statement linking to a Form on a Lexeme
THEN the value has a lang attribute
AND the language code is taken from the language variant of the Form being linked to

GIVEN a statement linking to a Sense
THEN the value has two language attributes
AND the language code for the first part of the Sense is taken from the spelling variant of the Lexeme for the Sense being linked to
AND the language code for the second part of the Sense is taken from the language of the Gloss of the Sense being linked to

Acceptance criteria:

  • values in Statements linkingto Forms and Senses have the correct lang attribute attached to them

Notes:

  • Be aware of multiple spelling variants like on https://www.wikidata.org/wiki/Lexeme:L220599
  • Code worth looking at: src/Presentation/Formatters/{Lexeme,Sense,Form}IdHtmlFormatter.php – LexemeIdHtmlFormatter already has code to add a lang in formatLemmas(), which matches the fact that for lemmas this already works correctly
  • Probably use LanguageCode::bcp47() to make sure we emit the correct language code for HTML, not MediaWiki (LexemeIdHtmlFormatter might currently do this wrong, please check)

Event Timeline

Lydia_Pintscher set the point value for this task to 5.

Change 641988 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Add lang attribute to representations in form values

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

Change 642022 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] Add dir attribute to representations in form values

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

Change 641988 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Add lang attribute to representations in form values

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

Change 642022 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] Add dir attribute to representations in form values

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

Change 643068 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/WikibaseLexeme@master] SenseIdHtmlFormatter: add lang and dir attributes

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

Change 644241 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] LocalizedTextProvider: add getEscaped method

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

Change 643245 had a related patch set uploaded (by Jakob; owner: Jakob):
[mediawiki/extensions/Wikibase@master] LocalizedTextProvider::getEscaped: allow raw params

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

Change 644241 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] LocalizedTextProvider: add getEscaped method

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

Change 643245 merged by jenkins-bot:
[mediawiki/extensions/Wikibase@master] LocalizedTextProvider::getEscaped: allow raw params

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

Change 643068 merged by jenkins-bot:
[mediawiki/extensions/WikibaseLexeme@master] SenseIdHtmlFormatter: add lang and dir attributes

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

Lydia_Pintscher added a subscriber: Lydia_Pintscher.

This works for Forms in production now \o/

Unfortunately the example linked in the description for the Sense doesn't work yet for me in production :/

Hm, it looks alright for me:

Screenshot from 2020-12-15 14-36-24.png (485×589 px, 54 KB)

Or am I looking at the wrong thing?

Purge didn't help. Looking at some others now.

Ok worked on the sandbox Lexeme so maybe just some caching issue.
\o/

Yay! Looks good \o/

Purge didn't help. Looking at some others now.

I purged it too and that made it work for me. Odd