Page MenuHomePhabricator

Write&Use Action to actually make the language code Inference work
Closed, ResolvedPublic

Description

This task ties together the work that was in TBC and T305539, and so it depends on them being done first.

To make language code inference work, an action is needed that is probably triggered by the selected value of the LanguageLookup changing.

This action should probably do the following things:

  1. set the language store field to whatever was selected in the LanguageLookup
  2. set the languageCodePropertyValue store field to undefined
  3. use the repository/service created in T305539 to retrieve the language code property data from the API
  4. if a language code was returned by the api, then validate it
  5. set the languageCodePropertyValue store field accordingly, see the table below

Finally, the App components need to be told how to react to the languageCodePropertyValue, see the below:

Conceptual statelanguage store fieldlanguageCodePropertyValue store fieldapp state
No language Item selected (initial state)falsyundefinedNo spelling variant lookup, no warning message
Loading language code request'Q123'undefinedNo spelling variant lookup, no warning message (maybe loading indicator shown?)
No language code'Q123'nullYes spelling variant lookup, no warning message.
Invalid language code (meaning the retrieved code is not in the list of allowed codes)'Q123'falseYes spelling variant lookup, yes warning message.
Valid language code'Q123''en-ca'No spelling variant lookup, no warning message.

Event Timeline

Several GitHub pull requests merged (#135, #130, #136); updating the Cypress test is still open (currently it probably tries to get the language code of Wikidata Q123, which isn’t ideal), and then we also need to update WikibaseLexeme.git so this can be tested on Beta.

Michael added a project: Patch-For-Review.

Cypress tests: https://github.com/wmde/new-lexeme-special-page/pull/139

I think after this patch is merged we can update WikibaseLexeme.git with the newest version of the app.

Change 780765 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/WikibaseLexeme@master] Bump Special New Lexeme to include lang code inference

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

Change 780765 merged by jenkins-bot:

[mediawiki/extensions/WikibaseLexeme@master] Bump Special New Lexeme to include lang code inference

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