Last modified: 2012-07-24 12:38:11 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 T31357, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29357 - CategoryTree should have built-in localizable support for pretty Categorytree-member-num
CategoryTree should have built-in localizable support for pretty Categorytree...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
CategoryTree (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Amir E. Aharoni
: i18n, patch, patch-need-review
: 26405 (view as bug list)
Depends on:
Blocks: 18521
  Show dependency treegraph
 
Reported: 2011-06-12 06:36 UTC by Amir E. Aharoni
Modified: 2012-07-24 12:38 UTC (History)
6 users (show)

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


Attachments
Patch to fix the problem. Should be tested. (4.96 KB, patch)
2011-09-19 16:53 UTC, Amir E. Aharoni
Details
the same patch with fixes according to Niklas' comments (4.94 KB, patch)
2011-09-19 20:11 UTC, Amir E. Aharoni
Details

Description Amir E. Aharoni 2011-06-12 06:36:34 UTC
Many Wikipedias customized MediaWiki:Categorytree-member-num to show the number of sub-categories, pages and files in the parentheses after the category name, something like (3 C, 5 P, 1 F). Even for English this requires rather weird parser function tricks to make the comma appear in the correct places, and other languages need even stranger tricks - for example in Hebrew "one" comes after the noun, but other numbers come before it, so i had to use #switch and jump through even more hoops to get the comma appear correctly.

I checked the 20 largest Wikipedias and MediaWiki:Categorytree-member-num was customized in all of them in much the same way. Since there apparently is demand for this feature and the eventual functionality is quite the same everywhere, it should be done this way:

1. There should be abbreviated localizable messages for C, P and F (category, page, file), something like:
categorytree-category-count-short: {{PLURAL:$1|1 C|$1 C}}
categorytree-page-count-short: {{PLURAL:$1|1 P|$1 P}}
categorytree-file-count-short: {{PLURAL:$1|1 F|$1 F}}

2. Then after the category name all the non-zero values can be shown, joined by a comma on the extension code level.

3. If all the values are zeroes, the word "empty" should be shown. (There should be another localizable message for this.)

I didn't find any project that implemented this differently, but if there is such a project, it can keep using Categorytree-member-num.
Comment 1 Niklas Laxström 2011-09-09 09:12:50 UTC
Is this information something we want to display by default, and is this the format we want to display it?
Comment 2 Amir E. Aharoni 2011-09-09 09:26:26 UTC
(In reply to comment #1)
> Is this information something we want to display by default, and is this the
> format we want to display it?

Well, see above - it was enabled and customized in a nearly identical way in many Wikipedias, so the answer is probably yes.
Comment 3 Siebrand Mazeland 2011-09-14 13:39:20 UTC
Amir volunteered during triage. Brain offered to assist Amir when needed.
Comment 4 Amir E. Aharoni 2011-09-19 16:53:05 UTC
Created attachment 9073 [details]
Patch to fix the problem. Should be tested.

Added the messages:
* categorytree-num-categories
* categorytree-num-pages
* categorytree-num-files
* categorytree-num-empty

Added documentation for all of them and for categorytree-member-num and also localized them for Hebrew.

Rewrote the part that uses categorytree-member-num to automatically create a comma-separated list of relevant member counts. categorytree-member-num will still be used the same way if it is customized on wiki.
Comment 5 Niklas Laxström 2011-09-19 17:26:33 UTC
The patch looks fine. Few notes though:
* array_push is not commonly used when appendin elements to array. The shorthand $array[] = $elem; is much more common.
* It lacks some whitespace according to your style guide. Do you know /trunk/tools/code-utils/stylize.php?
* I see that the div has dir depending on the interface language, but has literate RLM/LRM marker in content language inside, is that correct?
Comment 6 Amir E. Aharoni 2011-09-19 20:09:30 UTC
(In reply to comment #5)
> The patch looks fine. Few notes though:
> * array_push is not commonly used when appendin elements to array. The
> shorthand $array[] = $elem; is much more common.

It's a Perlism :)

> * It lacks some whitespace according to your style guide. Do you know
> /trunk/tools/code-utils/stylize.php?

No, thanks for telling.

> * I see that the div has dir depending on the interface language, but has
> literate RLM/LRM marker in content language inside, is that correct?

Yes, it's correct and it was there before my change. Without it a category with an LTR title in an RTL wiki is displayed incorrectly.
Comment 7 Amir E. Aharoni 2011-09-19 20:11:07 UTC
Created attachment 9075 [details]
the same patch with fixes according to Niklas' comments

The same patch with fixes according to Niklas' comments - stylize and '$memberNums[] =' instead of 'array_push'.
Comment 8 Amir E. Aharoni 2011-10-17 11:36:21 UTC
Applied in r100023.
Comment 9 Bawolff (Brian Wolff) 2012-07-24 12:38:11 UTC
*** Bug 26405 has been marked as a duplicate of this bug. ***

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


Navigation
Links