Page MenuHomePhabricator

Special:Browse should translate object page and category names
Closed, DeclinedPublic

Description

Author: info

Description:
Special:Browse translates subjects of properties, redirects and property names into the user's language (if $smwgTranslate is true), but it does not translate category names and pages when they are the objects of annotations.

Steps to reproduce:

  1. Set $smwgTranslate = true in SMW_Settings.php
  2. Provide interwiki translations, e.g. add [[fr:Propriété:situé à]] to Property:Located_in, [[fr:Allemagne]] to Germany, and [[fr:Catégorie:Ville]] to Category:Cities.

3 Create a page using this property, category, and page, e.g. "Stuttgart" with

In [[located in::Germany]]   [[Category:Cities]]
  1. Click the browse "eye" icon for Stuttgart
  2. Then in preferences change your language to fr - Francais, or tack ?uselang=fr on to the Special:Browse URL.

Actual results:
"Located in Germany" changes to "Propriété:situé à Germany"
"Categories Cities" changes to "Catégories Cities"

Note the property name and namespace are translated, but not the page and category titles.

Expected results:
"Propriété:situé à Allemagne"
"Catégories Ville"

Alas, this enhancement isn't as simple as adding smwfT() around these printouts to translate them. In SMW_Browse.php, the SMWStore returns categories and the objects of properties of type:Page as SMWWikiPageValue instances and SMW_Browse displays them by invoking their getLongHTMLText($skin) method. There's currently no way to tell a SMWWikiPageValue "display this translated text when making a link of this title" because the text it displays is a private member (m_textform) with no setter. Furthermore, SMWWikiPageValue gets its m_textform from MediaWiki's Title object, and that also has no way to specify a translated text form.

Arguably, MediaWiki's Title object should implement a method Title->getInterlangText($lang) that hides these details and optimizes the common case where the content lang == the user's lang.


Version: unspecified
Severity: enhancement

Details

Reference
bz13309

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:05 PM
bzimport set Reference to bz13309.

Assigned to developer for comments.

Unknown Object (User) added a comment.Jun 10 2012, 7:37 AM

This might be solved by having access to the context (class RequestContext, $context->msg(), $context->getTitle() etc.). Add 37445 dependency.

@Denny, this is one of the oldest tasks assigned to someone. Are you planning to work on it, and is its current priority correct?

Qgil removed Denny as the assignee of this task.Feb 14 2015, 3:42 PM
Qgil set Security to None.
Aklapper subscribed.

The Semantic MediaWiki developers requested in https://phabricator.wikimedia.org/T64114 to move their task tracking to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues and to close remaining tasks in Wikimedia Phabricator. If you still face the problem reported in this task in a supported version of SMW, please feel free to transfer your report to https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues . We are sorry for the inconvenience.