Page MenuHomePhabricator

Add feature to allow multilingual headings for translated MassMessage newsletters
Closed, ResolvedPublic

Assigned To
Authored By
Quiddity
May 4 2017, 4:10 PM
Referenced Files
F34944275: Capture d’écran_2021-12-01_22-29-08.png
Feb 7 2022, 2:06 PM
F34942130: image.png
Feb 4 2022, 7:24 AM
F34941120: image.png
Feb 3 2022, 7:28 AM
F34769578: image.png
Nov 26 2021, 9:05 AM
F7913147: Selection_026.png
May 4 2017, 5:41 PM
Tokens
"Love" token, awarded by Trizek-WMF."Doubloon" token, awarded by SpartacksCompatriot.

Description

When delivering a MassMessage, it is not possible to use a multilingual header [heading, title, topic, subject], per https://meta.wikimedia.org/wiki/Newsletters/Translation#Known_limitations

This frustrates communities who have translated a message into their own language, but are unable to help with the delivered heading, until it is posted everywhere.

Please help determine the best way to implement this. Thanks!


Note: We can partially use switch, e.g.

{{subst:#switch:{{subst:CONTENTLANG}}|fr=Test message|#default=Test message 2}}

which creates this semi-successful diff, but it has 2 problems:

  • The edit summary is the raw code
  • The subject is restricted to 240 characters, which limits how many languages can be included. E.g. a long title, or many languages, will break like this:

Selection_026.png (625×764 px, 42 KB)


Outcome

MassMessage now allows a section of a (translatable) page to be sent as subject. See documentation: https://www.mediawiki.org/wiki/Help:Extension:MassMessage#Choose_a_section_of_(translatable)_page_as_a_message_or_subject

image.png (790×1 px, 80 KB)

Event Timeline

An easy win would be to allow an edit summary as distinct from the section title, and make the section title the part of the message (much like how you can use section=new, leave the title field empty, and put == Title == in the textarea). That would allow a translatable title with English edit summary and without the clickable arrow linking to the section - a bit annoying but understandable.

A nicer approach would be to allow a message key instead of plain text, provided by Translate. The message would only be available on the source wiki though so the master job creating the writer jobs on each target wiki would have to figure out the wiki language beforehand and select the right language (or fetch and pass the list of all existing translations).

MassMessage extension now allows a translatable page or a section in it to be sent as a message.

We could utilize that functionality to allow a section of the same page to be sent as subject.

If a section is selected to be sent as subject, Subject of the message field would be ignored. We could a help message to indicate that.

Rough mock up:

image.png (629×755 px, 43 KB)


Technical details

Changes in form

  1. Add a control that lists sections in the page being sent
  2. Modify other aspects of the form to indicate
  3. Display the subject in the preview

Job related changes

  1. Add a new parameter to be passed on in the job
  2. In MassMessageJob, call the source API to fetch the subject based on the section passed.
  3. Use that content as the edit summary and as subject.

Change 749149 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/MassMessage@master] WIP: Add functionality to send multi-lingual subject

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

Change 749149 abandoned by Abijeet Patro:

[mediawiki/extensions/MassMessage@master] WIP: Add functionality to send multi-lingual subject

Reason:

Will submit another patch

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

Change 749453 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/MassMessage@master] WIP: Add functionality to send multi-lingual subject

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

abi_ changed the task status from Open to In Progress.Dec 28 2021, 11:50 AM
abi_ claimed this task.

Change 753728 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/MassMessage@master] Sanitize page message and custom subject

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

Testing notes

Setup

  • Page being sent as message - Translated to fr, pt only
  • Page to send message to - TestMessageList - fr, pt-BR, IT, EN

Expected outcome

  1. fr page should receive messages in fr
  2. pt-br page should receive messages in pt
  3. it page should receive messages in en
  4. en page should receive messages in en

Cases

  1. OK: Check with page subject and page message (no page message section)
  2. OK: Check with page subject and subject both provided (no page message section). Expected output: Subject should be ignored
  3. OK: Only page message is provided, with subject (no page message section)
  4. OK: Check with page subject and page message section
  5. OK: Check with only page message section provided with subject
  6. OK: Normal message - no page message selected
  7. OK: Test fallback language delivery with page subject and page message section
  8. OK: Test fallback language delivery with only page message (no subject or page message section)

Other things to check

  • With all tests include a custom message.
  • Check message tag wrapping based on target language

Issues

  • [FIXED] Problems with Subject section on Preview - Rendered HTML becomes:
== <div lang="en" dir="ltr" class="mw-content-ltr">
<section begin="subject" />
<translate>
<!--T:2-->
Subject section
</translate>
<section end="subject" />
</div> ==

Change 749453 merged by jenkins-bot:

[mediawiki/extensions/MassMessage@master] Add functionality to send multi-lingual subject

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

Change 753728 merged by jenkins-bot:

[mediawiki/extensions/MassMessage@master] Sanitize page message and custom subject

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

Change 758796 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/MassMessage@master] Special:MassMessage: Fix empty subject validation

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

Change 758796 merged by jenkins-bot:

[mediawiki/extensions/MassMessage@master] Special:MassMessage: Fix empty subject validation

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

On meta, it is now possible to select a section to be sent as a subject. If that section is part of a translatable page then the subject will be delivered in either the language of the target page or a fallback.

Few things to note,

  1. This change is not yet deployed on the various Wikipedia and other Group 2 sites.
  2. If a section is selected to be sent as a message, then subject of the message will be ignored.
  3. Known issue: Subject of the message is mandatory even if a section is selected to be sent as message. This is not a major issue since it will be ignored if a section is selected to be sent as message. This will be fixed with the next train.

Documentation update is pending.

See screenshot below,

image.png (790×1 px, 56 KB)

This change has now rolled out to all the Wikis

Trizek-WMF subscribed.

Thank you very much for working on this, @abi_ !

I tested it, and I think I found a bug: if I leave the subject field empty, as documented on the form "This is ignored if a section of the page is selected to be sent as subject", I however get an error message: "The subject line is empty." And I can't send my message.

Capture d’écran_2021-12-01_22-29-08.png (744×532 px, 98 KB)

I used this page as my test message: https://meta.wikimedia.org/wiki/User:Trizek_(WMF)/sandbox/translation_tests

Also, can I suggest to have the title of the page to be selected as the topic of the message?

I tested it, and I think I found a bug: if I leave the subject field empty, as documented on the form "This is ignored if a section of the page is selected to be sent as subject", I however get an error message: "The subject line is empty." And I can't send my message.

This is a known issue, see T164503#7673732.

Also, can I suggest to have the title of the page to be selected as the topic of the message?

Can you share an example where this would be useful? Messages are usually on subpages, whose titles are not suitable as message headings (e.g. m:Tech/News/2022/06 will be distributed with the title Tech News: 2022-06, not Tech/News/2022/06).

I tested it, and I think I found a bug: if I leave the subject field empty, as documented on the form "This is ignored if a section of the page is selected to be sent as subject", I however get an error message: "The subject line is empty." And I can't send my message.

This is a known issue, see T164503#7673732.

Mmmmh... more coffee is needed at my desk. :D Thank you.

Also, can I suggest to have the title of the page to be selected as the topic of the message?

Can you share an example where this would be useful? Messages are usually on subpages, whose titles are not suitable as message headings (e.g. m:Tech/News/2022/06 will be distributed with the title Tech News: 2022-06, not Tech/News/2022/06).

https://meta.wikimedia.org/wiki/Tech/Server_switch could be a case. And we we can also imagine to have new mass messages being designed to use the page title instead of having one extra field to translate.

That was also distributed as Server switch in September, not as Tech/Server switch.

And we we can also imagine to have new mass messages being designed to use the page title instead of having one extra field to translate.

As I wrote above, page titles usually differ from message subjects. I don’t think either using an out-of-place page title to match the message subject or using an unnatural message subject containing slashes to match the page title would be acceptable. If the goal is to have as few translation units as possible, I’d rather disable the translation of page titles than use the same text for the title and the subject.

Lifting up the limitation is also a way to allow new ways to prepare translatable pages. We can have messages without slashes, and we shouldn't limit ourselves because of these slashes.

For Tech/Server switch, a specific namespace should have been created, and hence we could use the page title, but we are drifting off topic there. :)

I tested it, and I think I found a bug: if I leave the subject field empty, as documented on the form "This is ignored if a section of the page is selected to be sent as subject", I however get an error message: "The subject line is empty." And I can't send my message.

This is now fixed on meta.

Marking this task as resolved. Please report any issues that you encounter.