Last modified: 2010-03-11 20:14:39 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T24318, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 22318 - Special:Templates doesn´t look for localized category entries in template body
Special:Templates doesn´t look for localized category entries in template body
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-29 15:00 UTC by Uwe
Modified: 2010-03-11 20:14 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Uwe 2010-01-29 15:00:05 UTC
In SF_Templates.php function getCategoryDefinedByTemplate(...) looks for (least) category entry in each template body to show this as "defined category". Doing this a regex is used:

'/\[\[Category:([\w ]*)/' 

So a potentially localized namespace name (in German "Kategorie:") cannot be found, only canonical "Category:"!

A solution might be:
In function getCategoryDefinedByTemplate(...):
1. use of MediaWiki global variable $wgContLang
2. replacement of the regexp with:

'/\[\[(Category|'.$wgContLang->getNsText(14).'):([\w ]*)/'
Comment 1 Uwe 2010-01-29 15:31:28 UTC
Use of option \w leads to the situation, that special characters in category names (e.g. ä, ö, ü, Ä, Ö, Ü, ß for  Germans) -- that standard MediaWiki can handle -- "cut off" themselves and the rest of category name. So for a

Category:Mühle

parser only will find 

Category:M

Seems to be better use of

'/\[\[(Category|'.$wgContLang->getNsText(14).'):.+\]\])/'

so at least one following character after ":", and cut off "]]" after this. So special characters could be accepted.
Comment 2 Yaron Koren 2010-02-03 04:46:15 UTC
Thanks for the fix! This was added in SF version 1.8.8.
Comment 3 Uwe 2010-02-05 15:32:23 UTC
To my sorrow you have implemented ONLY the localized form of category "name".

In my suggestion there was '...

'/\[\[(Category|'.$wgContLang->getNsText(14).'):.+\]\])/'

instead of 

"/\[\[$cat_ns_name:(.*)\]\]/"

to assure that BOTH the standard English version AND the localized version $wgContLang->getNsText(14) can work.
Comment 4 Uwe 2010-02-05 15:34:55 UTC
Should be

"/\[\[($cat_ns_name|Category):(.*)\]\]/"
Comment 5 Liangent 2010-02-05 15:40:44 UTC
But what if namespace aliases exist?
Comment 6 Uwe 2010-02-05 16:23:32 UTC
NS alias for "Category"?

If so - it would fail, but who does such things?

But localized NS names are standard...
Comment 7 Liangent 2010-02-06 10:28:11 UTC
(In reply to comment #6)
> If so - it would fail, but who does such things?

zhwiki does (though this will not be used there).

"Category" is the localized name there; "分类" and "分類" are aliases (in zh-hans and zh-hant).
Comment 8 Yaron Koren 2010-03-11 20:14:39 UTC
Sorry - should have just copied your code in exactly the first time. It's now there, correctly, in v. 1.9. It still doesn't support category aliases, but I'm setting this to "FIXED" anyway.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links