Page MenuHomePhabricator

Represent the selected topic and language pair as URL parameters
Open, HighPublic

Description

As part of MinT for Wikipedia Readers MVP (T359072) access is provided to machie translated version of the content. This can be used in very different contexts, and we want to support users to share translations, link to them in wiki pages or integrate them in external tools.

Currently it is not possible to link to a specific translation since the different aspects of the translation are not reflected in the URL. This ticket proposes to support users to link to the Confirm (T359512) or the Translation View (T359801) directly. by provide URL parameters.

Proposed parameters:

  • topic/page. The page to translate. We can decide how much to the current search flexibility we can expose and how much we want the parameter to align with the one used in Content Translation ("page") or differ from it if it ("topic") works differently.
  • from. Language code of the source language. If missing or invalid, destination will be the Confirm step for the user to select one.
  • to. Language code of the target language. If missing or invalid, destination will be the Confirm step for the user to select one.
  • confirm. Indicates that the Confirm step will be the destination to allow users to make final adjustments before reaching the translated content.

Event Timeline

Pginer-WMF created this task.
Pginer-WMF moved this task from Backlog to Product integration on the MinT board.

Change #1031037 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] MinT MVP: Add URL params

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

Change #1031038 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] MinT MVP: Redirect to confirm/translation page based on URL params

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

Change #1031037 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] MinT MVP: Add URL params

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

Change #1031038 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] MinT MVP: Redirect to confirm/translation page based on URL params

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

@ngkountas I did test but I want to make sure my approach is correct. This is to get to the confirm translation page by not searching for the article but using a link to the page ?

see video below:

As indicated by the screencast above, the following URL parameters are being set when an article is selected inside the search screen:

  • page (title of the page in display language)
  • from (source language of the translation)
  • to (target language of the translation)
  • display (language in which the search result is being displayed. Also the language in which the page title is provided in the URL)
  • step (the current step - can be either "confirm" or "translation")

Based on the above, I believe we can close this task as done.

  • page (title of the page in display language)
  • display (language in which the search result is being displayed. Also the language in which the page title is provided in the URL)

I'm curious about the use of the display language. If I understand this correctly, the display parameter is basically indicating which language is used for the search of the topic. For example, in the URL below the term "Sonne" is searched in German to find the article about the Sun, and the French version of it is used to show an automatic translation into Japanese:

https://en.m.wikipedia.org/wiki/Special:AutomaticTranslation?page=Sonne&from=fr&to=ja&display=de&step=confirm

Am I interpreting the above correctly? The "display" name was a bit confusing since nothing is displayed in that language. So I wanted to double-check it is working as I was interpreting.

Taking the above example, and changing the to parameter to German, results in an empty page: https://en.m.wikipedia.org/wiki/Special:AutomaticTranslation?page=Sonne&from=de&to=ja&display=de&step=confirm

Screenshot 2024-06-03 at 14.19.54.png (787×1 px, 185 KB)

I would expect the display parameter to be optional, taking the value of the from language as a fallback when display is not provided. Not sure if that was intended in the implementation since I could not check it as per the baove.

Change #1039254 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] MinT: Make display URL param optional for redirection to "confirm" step

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

I found some cases where reaching the Translation view through the UI results in an URL that when reloading the browser page shows a blank page with JS errors. For example: https://ca.m.wikipedia.org/wiki/Special:AutomaticTranslation?page=Plants+in+space&from=en&to=ca&display=en&step=translation

Screenshot 2024-06-06 at 11.21.37.png (711×1 px, 159 KB)

@Pginer-WMF this happens when "display" language is the same as the source language. I have submitted a patch that fixes this case, but even more I have submitted another patch (linked to this task), that entirely removes the "display" language, since as you observed, it's not used anywhere, and we can just rely on the source language and title.

Change #1039252 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] MinT: Simplify pageSearchResult sourceTitle getter

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

Change #1039252 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] MinT: Simplify pageSearchResult sourceTitle getter

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

Change #1039254 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] MinT: Remove display URL param

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