Author: md5
Description:
On English Wiktionary, there is a convention of using language codes as prefixes for topical category names in languages other than English. For example, there is a category called "Category:Fruits" for English words related to fruits, but it also has subcategories like "Category:es:Fruits" and "Category:la:Fruits" for Spanish and Latin respectively. You'll notice that these name prefixes generally match the interwiki names for the other language Wiktionaries.
The issue that I'm seeing is that when using the AJAX-based category expansion, the wrong set of categories is being returned when expanding something like "Category:la:Fruits". It effectively returns the subcategories for "Category:Fruits" instead of "Category:la:Fruits".
I tracked the issue down to the "makeTitle" function in CategoryTreeFunctions.php, but I'm not sure what the right fix is. What seems to be happening is that there is a call to Title::newFromText that looks like this:
$t = Title::newFromText( $title, NS_CATEGORY );
In the case of "Category:la:Fruits", the value of $title is "la:Fruits". Inside of "newFromText", this is passed to Title::secureAndSplit which interprets the the "la:" as an interwiki prefix and strips it, giving us "Category:Fruits" instead of "Category:la:Fruits".
In this particular case, I think it would work correctly to pass "Category:$title" to Title::newFromText, but that would end up showing weird behavior if $title already had a "Category:" or ":Category" prefix. Like I said, I'm not sure whether the right fix is in the "makeTitle" function of CategoryTreeFunctions.php or if something needs to be done in the Title class (e.g. taking mNamespace into account in the interwiki portion of secureAndSplit since "iw:PAGENAME" shouldn't actually be an interwiki link unless the default namespace is NS_MAIN). It seems like it's hard for me actually test a fix without bringing up a full MediaWiki installation that has the same interwiki map as English Wiktionary.
Here is an example URL that is used when expanding "Category:la:Fruits" in a category tree:
http://en.wiktionary.org/w/index.php?action=ajax&rs=efCategoryTreeAjaxWrapper&rsargs[]=la:Fruits&rsargs[]=0
Version: unspecified
Severity: normal
URL: http://en.wiktionary.org/wiki/Category:Latin_language