Page MenuHomePhabricator

Language variant support for page content service and restbase services
Open, NormalPublic

Description

Problem

Content from the page content service doesn't match the language variant preference for users of wikis with language variants (zhwiki, srwiki, and others)

Proposed solution

Enhance the content service to have the content returned be in the first available language variant of the user's preferred language variants. Preferred language variant lists would be communicated using the Accept-Language header in the standard format ( https://tools.ietf.org/html/rfc7231#section-5.3.5 ).

How

Utilize a method similar to core to process the Accept-Language header and pick the appropriate variant for the request:

Logic for parsing Accept-Language in core is WebRequest::getAcceptLang() (general header parsing, sorts by priority given) and LanguageConverter::getHeaderVariant() (iterates through language codes converting them to valid variants and picking one). Also LanguageConverter::validateVariant() which removes case sensitivity, remaps deprecated codes, converts zh-cn to zh-Hans-CN, etc.

Only variants that are valid for the domain requested should be returned. For example, requests to https://sr.wikipedia.org will only pick a Serbian variant even if the user has English with a higher rank in their Accept-Language header.

Event Timeline

JoeWalsh created this task.Jul 11 2019, 8:37 PM
Restricted Application added subscribers: Petar.petkovic, Cosine02, Aklapper. · View Herald TranscriptJul 11 2019, 8:37 PM
JoeWalsh renamed this task from Language variant support for /page/summary to Language variant support for page content service.Jul 11 2019, 8:59 PM
JoeWalsh updated the task description. (Show Details)
JoeWalsh updated the task description. (Show Details)Jul 12 2019, 12:29 PM
JoeWalsh triaged this task as Normal priority.Jul 16 2019, 7:08 PM
JoeWalsh moved this task from Needs triage to Epics on the Product-Infrastructure-Team-Backlog board.
MSantos moved this task from Backlog to Epics on the Page Content Service board.Mon, Sep 2, 4:54 PM
Jhernandez renamed this task from Language variant support for page content service to Language variant support for page content service and restbase services.Wed, Sep 11, 5:28 PM