Bug 29357: CategoryTree should have built-in localizable support for pretty Categorytree-member-num.

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.
This commit is contained in:
Amir E. Aharoni 2011-10-17 11:35:57 +00:00
parent 8c1d470c09
commit 230fffed11
Notes: Amir E. Aharoni 2011-10-17 11:35:57 +00:00
2 changed files with 37 additions and 4 deletions

View file

@ -38,7 +38,11 @@ If you have a very old browser, or have JavaScript disabled, it will not work.',
'categorytree-page-bullet' => ' ', # do not translate or duplicate this message to other languages
'categorytree-member-counts' => 'contains {{PLURAL:$1|1 subcategory|$1 subcategories}}, {{PLURAL:$2|1 page|$2 pages}}, and {{PLURAL:$3|1 file|$3 files}}', # $1=subcategories, $2=subpages, $3=files, $4=total, $5=shown-in-tree
'categorytree-member-num' => '($5)', # do not translate or duplicate this message to other languages
'categorytree-member-num' => '($5)', # do not translate or duplicate this message to other languages
'categorytree-num-categories' => '$1 C',
'categorytree-num-pages' => '$1 P',
'categorytree-num-files' => '$1 F',
'categorytree-num-empty' => 'empty',
'categorytree-load' => 'load',
'categorytree-loading' => 'loading…',
@ -63,6 +67,7 @@ If you have a very old browser, or have JavaScript disabled, it will not work.',
* @author Yekrats
* @author Александр Сигачёв
* @author פוילישער
* @author Amire80
*/
$messages['qqq'] = array(
'categorytree' => 'Title of [[Special:CategoryTree]]',
@ -91,6 +96,11 @@ Label for the category input field on Special:CategoryTree',
* $4 = total number of members,
* $5 = members to be shown in the tree, depending on mode.
Use with <nowiki>{{PLURAL}}</nowiki>',
'categorytree-member-num' => 'Do not translate or duplicate this message to other languages. It can be customized locally on a wiki.',
'categorytree-num-categories' => 'Number of sub-categories in a category. The word "categories" should be abbreviated. Appears in brackets after a name of an empty category. This message supports PLURAL.',
'categorytree-num-pages' => 'Number of pages in a category. The word "pages" should be abbreviated. Appears in brackets after a name of an empty category. This message supports PLURAL.',
'categorytree-num-files' => 'Number of sub-categories in a category. The word "files" should be abbreviated. Appears in brackets after a name of an empty category. This message supports PLURAL.',
'categorytree-num-empty' => 'The word "empty", as in "empty category". Appears in brackets after a name of an empty category.',
'categorytree-load' => '{{Identical|Load}}
Tooltip for the "expend" button, if the content was not yet loaded',
@ -1654,6 +1664,10 @@ $messages['he'] = array(
'categorytree-collapse' => 'כיווץ',
'categorytree-expand' => 'הרחבה',
'categorytree-member-counts' => 'כוללת {{PLURAL:$1|קטגוריית משנה אחת|$1 קטגוריות משנה}}, {{PLURAL:$2|דף אחד|$2 דפים}}, ו{{PLURAL:$3|קובץ אחד|־$3 קבצים}}',
'categorytree-num-categories' => '{{PLURAL:$1|קט אחת|$1 קט}}',
'categorytree-num-pages' => '{{PLURAL:$1|דף אחד|$1 דפים}}',
'categorytree-num-files' => '{{PLURAL:$1|קובץ אחד|$1 קב}}',
'categorytree-num-empty' => 'ריקה',
'categorytree-load' => 'טעינה',
'categorytree-loading' => 'בטעינה',
'categorytree-nothing-found' => 'לא נמצאו תוצאות',

View file

@ -650,12 +650,31 @@ class CategoryTree {
if ( $count !== false && $this->getOption( 'showcount' ) ) {
$pages = $pageCount - $subcatCount - $fileCount;
global $wgContLang, $wgLang;
$attr = array(
'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $subcatCount, $pages , $fileCount, $pageCount, $count )
'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $subcatCount, $pages , $fileCount, $pageCount, $count ),
'dir' => $wgLang->getDir() # numbers and commas get messed up in a mixed dir env
);
global $wgContLang, $wgLang;
$s .= $wgContLang->getDirMark() . ' ';
# Create a list of category members with only non-zero member counts
$memberNums = array();
if ( $subcatCount ) {
$memberNums[] = wfMessage( 'categorytree-num-categories', $wgLang->formatNum( $subcatCount ) )->text();
}
if ( $pageCount ) {
$memberNums[] = wfMessage( 'categorytree-num-pages', $wgLang->formatNum( $pageCount ) )->text();
}
if ( $fileCount ) {
$memberNums[] = wfMessage( 'categorytree-num-files', $wgLang->formatNum( $fileCount ) )->text();
}
$memberNumsShort = $memberNums
? $wgLang->commaList( $memberNums )
: wfMessage( 'categorytree-num-empty' )->text();
# Only $5 is actually used in the default message.
# Other arguments can be used in a customized message.
$s .= Xml::tags( 'span', $attr,
wfMsgExt( 'categorytree-member-num',
array( 'parsemag', 'escapenoentities' ),
@ -663,7 +682,7 @@ class CategoryTree {
$pages,
$fileCount,
$pageCount,
$wgLang->formatNum( $count ) ) );
$memberNumsShort ) );
}
$s .= Xml::closeElement( 'div' );