Page MenuHomePhabricator

Apply quick fix for the Wikibase text direction problem
Closed, ResolvedPublicBUG REPORT

Description

Hi. This solution is just for now. I'm planning to create an RfC task to discuss all the issues and all the options for language direction question in the extension, but it can take a year or more. There is a need to fix the worst problem right now, quickly, and the solution can remain or not in the long distance future. So, I'm publishing the task and starting to work on a Gerrit change just after that.

Reminder to the problem: the Wikibase sections in the watchlist are completely unreadable, because of the edit comments formatting. Here is my usual Wikidata watchlist:

Screenshot_20260119_144027_Samsung.png (696×1 px, 820 KB)

The bidirectional parts are randomly ordered, sometimes without spaces because they are on the wrong side. This happens because Wikidata has ltr direction, but the parsedcomments are in RTL, the language I chose in local Wikidata user preferences to understand the page name labels. I thought for weeks about a good quick solution, and I found one today. Here are my criterias for the good quick solution:

  1. Do not refactor the system, the change should be small.
  2. Use only the existing api calls, or in worst case add a minimum of them.
  3. Fix the problem at least in 99%.
  4. Do not break anything existing.

Here is the solution I'm implementing:

  1. Add to the list=watchlist API call the parameter responselanginfo=1, which returns the language of the call answer.
  2. If the site has isWikibase=true in its extension code config, ignore the site direction and use the direction from 1. above.
  3. To get the direction we add languageinfo to siteinfo on first iteration and keep in per run variable the whole dictionary. This will keep also the same number of API calls.
  4. Use the language from 1. above for the subsequent edit tags call.
  5. Use the language from 1. above for mw.msg of "Tags:" system message, if possible, enclose in <bdi> tags otherwise.
  6. Enclose in <bdi> tags every edit tag, all the "Tags: ..." part, edit comment and log action description.

That's all. Thank you.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
IKhitron triaged this task as Medium priority.
IKhitron added a project: User-IKhitron.
IKhitron moved this task from Backlog to Coding on the User-IKhitron board.
IKhitron updated the task description. (Show Details)

Change #1232599 had a related patch set uploaded (by IKhitron; author: IKhitron):

[mediawiki/extensions/GlobalWatchlist@master] Apply quick fix for the Wikibase text direction problem in Global Watchlist

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

Test wiki created on Patch demo by IKhitron using patch(es) linked to this task:
https://792d35f41e.catalyst.wmcloud.org/w/

I found a much easier way to get language direction. Rewrote the 3. above, and now there is no need in an extra API call.

Test wiki created on Patch demo by IKhitron using patch(es) linked to this task:
https://629f7bc5ca.catalyst.wmcloud.org/w/

I don't think I understand why we have to fetch the "Tags:" system message in a different language from the rest of the interface, and *only* do this for Wikidata rows? It seems that would just make them inconsistent. The tags for every wiki are displayed in that wiki's language.

I don't think I understand why we have to fetch the "Tags:" system message in a different language from the rest of the interface, and *only* do this for Wikidata rows? It seems that would just make them inconsistent. The tags for every wiki are displayed in that wiki's language.

I thought it will make the line for consistent direction-wise. Do you want me to remove this?

I think I would remove it, and just wrap the "Tags:" in <bdi> like everything else. It seems like the most complex and least valuable part of your change :)

I think I would remove it, and just wrap the "Tags:" in <bdi> like everything else. It seems like the most complex and least valuable part of your change :)

Very well, I'll do it for this change. But I'll heavily consider to do this in another task for every wiki, pros and cons.

I think I would remove it, and just wrap the "Tags:" in <bdi> like everything else. It seems like the most complex and least valuable part of your change :)

Done.

Change #1232599 merged by jenkins-bot:

[mediawiki/extensions/GlobalWatchlist@master] Apply quick fix for the Wikibase text direction problem in Global Watchlist

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

Test wiki on Patch demo by IKhitron using patch(es) linked to this task was deleted:

https://629f7bc5ca.catalyst.wmcloud.org/w/

Test wiki on Patch demo by IKhitron using patch(es) linked to this task was deleted:

https://792d35f41e.catalyst.wmcloud.org/w/