Page MenuHomePhabricator

Support language variants in Proton
Open, HighPublic

Description

Background information

Wikis have content in different language variants, that will get rendered depending on the language sent by the user agent.

Right now, the server side PDF renderer doesn't do anything particularly smart with the language, resulting in PDFs that are always rendered in the default variant for the wiki.

This makes it impossible to get PDFs in different variants in wikis like the chinese and serbian.

What

It should be possible to get rendered PDFs with a different language variant.

How

Proton should take into account the language header (accept-language) in the requests, and forward it to the renderer process in the best way possible.

The simplest solution could be just setting the language in chrome at instantiation, passing args: ['--lang=bn-BD,bn'] when doing a .launch, and that should automatically add the appropriate headers to all requests. Chrome args, Puppeteer docs.

If this approach had any problems, we can probably do with page.setExtraHTTPHeaders(headers) instead, setting Accept-Language there manually before making the page go to the wiki URL.

Acceptance criteria

  • Asking for a PDF sending a language variant header in the request, should result in the PDF content rendered in the requested language variant

Related tasks

Event Timeline

Tgr created this task.Jan 10 2019, 2:47 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 10 2019, 2:47 AM
Jhernandez triaged this task as Low priority.Jan 15 2019, 11:43 AM
Jhernandez added a subscriber: Jhernandez.

Seems like product hasn't prioritized this for now so moving to backlog as low

Jhernandez raised the priority of this task from Low to Normal.Jan 15 2019, 11:47 AM

Why is this dependent on Parsoid?

The restbase part for accepting and forwarding the header should be done, as we did adapt the other rest services to pass it along.

We would have to adapt proton to take the header and pass it to chromium either setting the navigator language or passing the header when loading the request.

Tgr added a comment.Jan 15 2019, 5:06 PM

Technically not dependent, just easier to develop/test once you can see some effect from doing it, I imagine.

@ovasileva Do you have an idea about the priority of this feature?

@Jhernandez - I would say let's keep it as normal - we've gotten a couple of requests for this in the past from users and I would say it makes a big different on projects with language variants.

ovasileva moved this task from Triage to Backlog on the Proton board.Feb 22 2019, 3:04 PM
Jhernandez raised the priority of this task from Normal to High.Feb 25 2019, 1:10 PM
Jhernandez updated the task description. (Show Details)Feb 25 2019, 1:21 PM
Restricted Application added a subscriber: Petar.petkovic. · View Herald TranscriptFeb 25 2019, 1:21 PM

Fleshed out the task, and making it high since it seems more important than the other proton tasks in the backlog

Viztor added a subscriber: Viztor.Jun 14 2019, 3:44 AM