Page MenuHomePhabricator

MF interlanguage labels are incomplete when the page title contains an en dash
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

See https://it.wikipedia.org/wiki/Mission:_Impossible_-_Dead_Reckoning_-_Parte_uno?useformat=mobile&uselang=it#/languages: for many languages (e.g., English), the label is just "Mission: Impossible", but if you click the link you will see that the actual page title contains an en dash and then more text. For instance, the page title on enwiki is "Mission: Impossible – Dead Reckoning Part One". The en dash and everything that follows are stripped from the label.

TODO

  • Update MediaWiki core to provide information for languages (autonym and name)
  • Update MobileFrontend to use the new data.

QA

Requirement

Ensure that interlanguage labels on the mobile site correctly display the full page title, including any en dashes and subsequent text.

BDD

Feature: Correct Display of Interlanguage Labels with En Dashes

  Scenario: Display full page title in interlanguage labels
    Given the user visits the interlanguage overlay on a page with an en dash in the title
    When the language overlay is displayed
    Then the full title, including the en dash and subsequent text, should be shown in the interlanguage labels

Test Steps

Test Case 1: Verify Full Title Display with En Dash in Language Overlay

  1. Visit the page on the Spanish Beta Wikipedia.
  2. Open the language overlay.
  3. AC1: Confirm that the title in the overlay includes the en dash and all text following it.

QA Results - Prod

ACStatusDetails
1T349000#10325213

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Just to reiterate that the concerns I raised on gerrit were not purely hypothetical, https://es.m.wikipedia.beta.wmflabs.org/w/index.php?title=Misi%C3%B3n_imposible%3A_sentencia_mortal_-_Parte_1#/languages still shows a truncated title, suggesting that the patch above does not fix the issue.

@Daimona the title does not look truncated to me. What am I missing?

Screenshot 2023-10-27 at 4.32.11 PM.png (546×1 px, 47 KB)

@Daimona the title does not look truncated to me. What am I missing?

It seems to depend on the interface language. I was reading the page in Spanish (default):

image.png (479×662 px, 25 KB)

If I switch to English, then I get the dash as in your screenshot.

Interesting. In Spanish the language appears like so:

"Mission: Impossible – Dead Reckoning Part One (inglés)"

I guess there is some localization happening here so we will need to extract the language differently based on language using the message (interlanguage-link-title)

Interesting. In Spanish the language appears like so:

"Mission: Impossible – Dead Reckoning Part One (inglés)"

I guess there is some localization happening here so we will need to extract the language differently based on language using the message (interlanguage-link-title)

Indeed, there are quite a few languages that have customized that message so it doesn't contain the hard-coded delimiter: https://translatewiki.net/wiki/Special:Translations?message=Interlanguage-link-title&namespace=8 . The way I see it, there are two ways forward:

  1. Extract the necessary components from the message using the message and some regex.
  2. Like you suggested in T349000#9254760, add a data-title attribute to the a element so we can use that.

I already have a prototype for the first one working, but it feels a bit messy, so I feel like the second one is cleaner and more robust. What do you think?

Yeh I think #2 seems like the right solution here.

Actually, I thought of a 3rd way to do it: Use the href attribute and use mw.util.percentDecodeFragment() to get the title from that. I can upload a patch for that, but the one I have doesn't get the langname (i.e. translated language name) for the return object in getLanguages, which might be a problem.

Actually, I thought of a 3rd way to do it: Use the href attribute and use mw.util.percentDecodeFragment() to get the title from that. I can upload a patch for that, but the one I have doesn't get the langname (i.e. translated language name) for the return object in getLanguages, which might be a problem.

I think this would be fine. I was wonderiong how this works with display title e.g https://en.m.wikipedia.org/wiki/IOS#/languages but it seems like the existing interface does not consider that (possibly another bug?) If we want to fix that bug perhaps the 2nd way is the better approach.

Jdlrobson added a subscriber: Edtadros.

Change 973890 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/extensions/MobileFrontend@master] Make getLanguages() more robust

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

What are the downsides of using a data-title attribute ?

What are the downsides of using a data-title attribute ?

That would certainly be easier, but we'd also need a data-langname attribute for the localized language names.

That does sound like it would be useful to have?

Indeed. Where would those need to be added? Core?

Jdlrobson changed the task status from Open to Stalled.Jul 26 2024, 4:43 PM

Hey did this get fixed? I can't reproduce it now on the test URL.

Change #973890 abandoned by Jdlrobson:

[mediawiki/extensions/MobileFrontend@master] Make getLanguages() more robust

Reason:

Sorry for dropping the ball on this. I can't reproduce the issue any more but if it's still occurring I think it would be better to fix this in a more future-proof way via a core change if possible https://phabricator.wikimedia.org/T349000#9338056

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

Daimona changed the task status from Stalled to Open.Jul 26 2024, 4:46 PM
Daimona updated the task description. (Show Details)

Hey did this get fixed? I can't reproduce it now on the test URL.

No. As noted in T349000#9288701, this can only be reproduced for certain languages. I've updated the URLs in the task description to make this explicit.

Thanks for the URL update! @jhsoby are you still interesting in helping get this fixed?

Thanks for the URL update! @jhsoby are you still interesting in helping get this fixed?

Yes, but I don't have time to commit to it at the moment. So if anyone else wants to take a stab at at and/or take over my patch, they're more than welcome to.

Change #1060806 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/core@master] Add data-langname and data-title attributes to interlanguage links

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

Change #1060806 merged by jenkins-bot:

[mediawiki/core@master] Add data-language-autonym and data-title attributes to interlanguage links

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

Change #973890 restored by Jdlrobson:

[mediawiki/extensions/MobileFrontend@master] Make getLanguages() more robust

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

Change #1062400 had a related patch set uploaded (by Jon Harald Søby; author: Jon Harald Søby):

[mediawiki/core@master] Add data-language-local-name to interlanguage links

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

Change #1062400 merged by jenkins-bot:

[mediawiki/core@master] Add data-language-local-name to interlanguage links

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

Test Result - Prod

Status: ❌ FAIL
Environment: itwiki, enwiki
OS: macOS
Browser: Chrome
Device: MS
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify Full Title Display with En Dash in Language Overlay

  1. Visit Mission:Impossible - Dead Reckoning - Parte uno.
  2. Open the language overlay.
  3. AC1: Confirm that the title in the overlay includes the en dash and all text following it.

@Jdlrobson, it appears that from the itwiki article, the language overlay shows the English article title incorrectly (missing the dash and all text after it), however, when I click on the language button from enwiki, the other languages show the articles with the dash and the text following it.

screenshot 3.mov.gif (890×1 px, 2 MB)

Yes this one is not completely fixed. It will need a follow up ticket and stay open. Thanks for confirming that!

Change #973890 merged by jenkins-bot:

[mediawiki/extensions/MobileFrontend@master] Make getLanguages() more robust

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

Test Result - Prod

Status: ✅ PASS
Environment: itwiki, eswiki
OS: macOS
Browser: Chrome
Device: MS
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Verify Full Title Display with En Dash in Language Overlay

  1. Visit Mission:Impossible - Dead Reckoning - Parte uno.
  2. Open the language overlay.
  3. AC1: Confirm that the title in the overlay includes the en dash and all text following it.

screenshot 32.png (1×496 px, 32 KB)

screenshot 31.png (1×496 px, 118 KB)