Last modified: 2012-06-10 07:37:41 UTC
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]]
4. Click the browse "eye" icon for Stuttgart
5. Then in preferences change your language to fr - Francais, or tack ?uselang=fr on to the Special:Browse URL.
"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.
"Propriété:situé à Allemagne"
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.
Assigned to developer for comments.
This might be solved by having access to the context (class RequestContext, $context->msg(), $context->getTitle() etc.). Add 37445 dependency.