Page MenuHomePhabricator

Content/User language mix ups leading to visual distortion
Closed, ResolvedPublic

Description

Detail of https://translatewiki.net/wiki/User:Aaron_Schulz?action=purge

Some weirdness in content language vs. user language and the cache being polluted because of it.

I'll try to describe everything involved as well as possible, and I have no idea of the root cause (hence the bug report :P).

Steps to reproduce:

  1. Be logged in on translatewiki.net
  2. Set Dutch as user language
  3. Go to https://translatewiki.net/wiki/User:Aaron_Schulz?action=purge
  4. Put the mouse pointer over the column header "Modification date".

Observed: A pop-up is shown in Dutch (see screenshot "UILang-nl-purged.png").

  1. Go to https://translatewiki.net/wiki/User:Aaron_Schulz?uselang=en

Observed: No pop-up is available like in step 4. Instead, the coloumn header now reads "Modification dateDit is een speciale eigenschap in de wiki." (see screenshot "UILang-nl-uselang-en.png"

  1. Go to https://translatewiki.net/wiki/User:Aaron_Schulz while logged out.

Observed: Same behaviour as in step 5. (screenshot "Anonymous.png").


Version: master
Severity: normal
URL: https://translatewiki.net/wiki/User:Aaron_Schulz

Attached:

Details

Reference
bz43205

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:52 AM
bzimport set Reference to bz43205.
bzimport added a subscriber: Unknown Object (MLST).

Created attachment 11530
Detial of https://translatewiki.net/wiki/User:Aaron_Schulz as anonymous user

Attached:

Unknown Object (User) added a comment.Dec 17 2012, 8:14 PM

translatewiki uses SMW 1.9 alpha, the Highlighter class (Introduced in 1.9 which prepares the tooltip content) is using the ContextSource to determine language and output.

Display/non-display issue

The problem is a missing resource ('ext.smw.tooltips').

The display/non-display issue of the tooltip relates to the problem that the resource that is responsible 'ext.smw.tooltips' is registered through the context object $this->getOutput()->addModules( 'ext.smw.tooltips' ); but that only works for pages that are refreshed or newly created but unfortunately when a page comes from the parser cache the resource is not registered any longer (this can be checked by looking at the page source).

A workaround is to replace the $this->getOutput()->addModules( 'ext.smw.tooltips' ) line in Highlighter class with SMWOutputs::requireResource( 'ext.smw.tooltips' ); (this way the resource is kept as static property and called through every page processing stage such as refresh, purge etc.)

User language/content language

As for the second problem of user language/content language, the Highlighter class only receives the content for a particular object (property, warning etc.) which means that the content provider (from where the Highlighter class is called) probably "sends" an inappropriate translated text.

I haven't checked it but because "Modification date" is a special property the SMWPropertyValue class should make the call when setting the content.

$highlighter->setContent( array (
'caption' => $text,
'content' => wfMessage( 'smw_isspecprop' )->text()
) );

Misc

I would appreciate an insight as to why ... getOutput()->addModules( ... ) (by using the ContextSource) only works for newly/purged pages and not for pages that are coming from the parser cache.

Besides that, I'm short-staffed at the moment that's why I don't really have the time to drill on these issues (and since it is not an official release yet I have no rush either), so anyone with some spare time please go ahead.

Unknown Object (User) added a comment.Dec 29 2012, 5:05 AM

A temporary fix [1] for the display/non-display issue has been provided

[1] https://gerrit.wikimedia.org/r/#/c/41202/