Page MenuHomePhabricator

Handle language variants in the suggestions table populate script
Closed, DeclinedPublic

Description

Figure out what, if anything, this should do with language variants.

This will require seeing how they're handled in Wikibase, and probably then some product-level discussion of how to translate that to what we're doing here.

Event Timeline

@cooltey I looked into this a bit. The counts table actually stores whatever value is provided for the language parameter in the POST body of the wbsetdescription query; so if "zh" is sent, that is what will be stored, and if "zh-hans" or "zh-hant" (or another variant) are sent, that is what will be stored and what will appear in the wikimediaeditortaskscounts response. Were you testing in the app or in a third-party API client application when you found that your description edits were all being recorded as simply "zh"? Is "zh" not what were you sending as language?

The bigger problem IMO is in the suggestions API, which does not consider variants at all, but only the default language code for a wiki (e.g., plain "zh") . That might not be very difficult to update; I'm looking into that now.

Thanks for the checking, @Mholloway .

I've updated the postDescription() method 3 months ago to send only zh if submitting description to either zh-hant or zh-hans articles.

You can find the difference here: https://github.com/wikimedia/apps-android-wikipedia/commit/6512743aea3ce021fee049e6d1f311d07f4ce04d

Once we can get the correct description (the current API will only get description under zh label from wikidata) from the API, we will need to update the code and it will send whether zh-hant or zh-hans to the wbsetdescription.

Once we can get the correct description (the current API will only get description under zh label from wikidata) from the API,

Is that T173842: [BUG] Wikidata description for the specific Chinese language variant should be shown?

The populateEntityDescriptionExistsTable script in the MediaWiki extension also needs updating to somehow handle variants. That's kind of a tricky one. To get variants for which descriptions are present would be a one-line change, but we also need info on variants for which descriptions are absent...

To get variants for which descriptions are present would be a one-line change,

Actually, that's not true. We can't just rely on the presence of a hyphen in a language string to indicate a variant, because several standalone wikis (including zh-classical, zh-min-nan, and zh-yue) have language codes with hyphens, but are full wikis rather than variants...

Is that T173842: [BUG] Wikidata description for the specific Chinese language variant should be shown?

Yes, that's the correct ticket I've mentioned, and I think it should be fine currently if users are consistently using a single variant when reading articles and submitting descriptions. (but we should still fix this issue ;))

Mholloway renamed this task from Figure out how to handle language variants to Handle language variants in the suggestions table populate script.Apr 1 2019, 9:27 PM

This table and its populate script are going away.