Page MenuHomePhabricator

prop=description should handle Chinese language variant correctly
Closed, DuplicatePublic

Description

The current prop=description API does not handle Chinese language variants correctly:

https://zh.wikipedia.org/w/api.php?action=query&format=json&prop=description&titles=%E4%B8%89%E7%81%A3%E9%84%89%20(%E5%8F%B0%E7%81%A3)

According to the wikidata page: https://www.wikidata.org/wiki/Q713793

When sending Accept-Language: zh-hant, it should show 位於苗栗縣 in Traditional Chinese column.
When sending Accept-Language: zh-hans, it should show an empty description.

And we should no longer use the wikidata description in Chinese column.

Event Timeline

@cooltey: Hi, which codebase project tag is this about? Asking as other people who don't know or don't care about team tags can also find this task when searching via codebase projects. Thanks.

tstarling renamed this task from The ApiQueryDescription should handle Chinese language variant correctly to prop=description should handle Chinese language variant correctly.May 19 2021, 1:16 AM
tstarling updated the task description. (Show Details)

I edited the task description because the class name was incorrect. In production this is implemented in Wikibase\Client\Api\Description.

I would like to know what is calling this API and whether it would be sufficient to add a variant parameter to the module. If a script calls the API from within a page context, I think the variant of the response should match the variant of the context page, which is not necessarily the same as the Accept-Language header. I would consider Accept-Language to be just for the UI, not for the API, unless there is a very good reason for doing otherwise.

Close this ticket and merge it to T353199 since the new ticket has more conversations and references.