Index: branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php |
— | — | @@ -280,20 +280,20 @@ |
281 | 281 | * @return String: Wikitext to add categories. |
282 | 282 | */ |
283 | 283 | protected static function mGenerateCategories( $code, $level ) { |
284 | | - global $wgBabelMainCategory, $wgBabelCategoryNames, $wgLanguageCode; |
| 284 | + global $wgBabelMainCategory, $wgBabelCategoryNames; |
285 | 285 | |
286 | 286 | $r = ''; |
287 | 287 | |
288 | 288 | if ( $wgBabelMainCategory !== false && $wgBabelCategoryNames[$level] !== false ) { |
289 | 289 | $category = self::mReplaceCategoryVariables( $wgBabelMainCategory, $code ); |
290 | 290 | $r .= "[[Category:$category|$level]]"; |
291 | | - BabelAutoCreate::create( $category, BabelLanguageCodes::getName( $code, $wgLanguageCode ) ); |
| 291 | + BabelAutoCreate::create( $category, $code ); |
292 | 292 | } |
293 | 293 | |
294 | 294 | if ( $wgBabelCategoryNames[$level] !== false ) { |
295 | 295 | $category = self::mReplaceCategoryVariables( $wgBabelCategoryNames[$level], $code ); |
296 | 296 | $r .= "[[Category:$category]]"; |
297 | | - BabelAutoCreate::create( $category, BabelLanguageCodes::getName( $code, $wgLanguageCode ), $level ); |
| 297 | + BabelAutoCreate::create( $category, $code, $level ); |
298 | 298 | } |
299 | 299 | |
300 | 300 | return $r; |
Index: branches/wmf/1.18wmf1/extensions/Babel/BabelAutoCreate.class.php |
— | — | @@ -23,19 +23,21 @@ |
24 | 24 | * Create category. |
25 | 25 | * |
26 | 26 | * @param $category String: Name of category to create. |
27 | | - * @param $language String: Name of language that the category is for. |
| 27 | + * @param $code String: Code of language that the category is for. |
28 | 28 | * @param $level String: Level that the category is for. |
29 | 29 | */ |
30 | | - public static function create( $category, $language, $level = null ) { |
| 30 | + public static function create( $category, $code, $level = null ) { |
31 | 31 | $category = strip_tags( $category ); |
32 | 32 | $title = Title::makeTitleSafe( NS_CATEGORY, $category ); |
33 | 33 | if ( $title === null || $title->exists() ) { |
34 | 34 | return; |
35 | 35 | } |
| 36 | + global $wgLanguageCode; |
| 37 | + $language = BabelLanguageCodes::getName( $code, $wgLanguageCode ); |
36 | 38 | if ( $level === null ) { |
37 | | - $text = wfMsgForContent( 'babel-autocreate-text-main', $language ); |
| 39 | + $text = wfMsgForContent( 'babel-autocreate-text-main', $language, $code ); |
38 | 40 | } else { |
39 | | - $text = wfMsgForContent( 'babel-autocreate-text-levels', $level, $language ); |
| 41 | + $text = wfMsgForContent( 'babel-autocreate-text-levels', $level, $language, $code ); |
40 | 42 | } |
41 | 43 | $article = new Article( $title, 0 ); |
42 | 44 | |
Index: branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTree.i18n.php |
— | — | @@ -38,7 +38,11 @@ |
39 | 39 | 'categorytree-page-bullet' => ' ', # do not translate or duplicate this message to other languages |
40 | 40 | |
41 | 41 | '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 |
42 | | - 'categorytree-member-num' => '($5)', # do not translate or duplicate this message to other languages |
| 42 | + 'categorytree-member-num' => '($5)', # do not translate or duplicate this message to other languages |
| 43 | + 'categorytree-num-categories' => '$1 C', |
| 44 | + 'categorytree-num-pages' => '$1 P', |
| 45 | + 'categorytree-num-files' => '$1 F', |
| 46 | + 'categorytree-num-empty' => 'empty', |
43 | 47 | |
44 | 48 | 'categorytree-load' => 'load', |
45 | 49 | 'categorytree-loading' => 'loading…', |
— | — | @@ -62,6 +66,7 @@ |
63 | 67 | * @author The Evil IP address |
64 | 68 | * @author Александр Сигачёв |
65 | 69 | * @author פוילישער |
| 70 | + * @author Amire80 |
66 | 71 | */ |
67 | 72 | $messages['qqq'] = array( |
68 | 73 | 'categorytree' => 'Title of [[Special:CategoryTree]]', |
— | — | @@ -90,6 +95,11 @@ |
91 | 96 | * $4 = total number of members, |
92 | 97 | * $5 = members to be shown in the tree, depending on mode. |
93 | 98 | Use with { {PLURAL} }', |
| 99 | + 'categorytree-member-num' => 'Do not translate or duplicate this message to other languages. It can be customized locally on a wiki.', |
| 100 | + '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.', |
| 101 | + '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.', |
| 102 | + '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.', |
| 103 | + 'categorytree-num-empty' => 'The word "empty", as in "empty category". Appears in brackets after a name of an empty category.', |
94 | 104 | 'categorytree-load' => '{{Identical|Load}} |
95 | 105 | |
96 | 106 | Tooltip for the "expend" button, if the content was not yet loaded', |
— | — | @@ -1598,6 +1608,10 @@ |
1599 | 1609 | 'categorytree-collapse' => 'כיווץ', |
1600 | 1610 | 'categorytree-expand' => 'הרחבה', |
1601 | 1611 | 'categorytree-member-counts' => 'כוללת {{PLURAL:$1|קטגוריית משנה אחת|$1 קטגוריות משנה}}, {{PLURAL:$2|דף אחד|$2 דפים}}, ו{{PLURAL:$3|קובץ אחד|־$3 קבצים}}', |
| 1612 | + 'categorytree-num-categories' => '{{PLURAL:$1|קט אחת|$1 קט}}', |
| 1613 | + 'categorytree-num-pages' => '{{PLURAL:$1|דף אחד|$1 דפים}}', |
| 1614 | + 'categorytree-num-files' => '{{PLURAL:$1|קובץ אחד|$1 קב}}', |
| 1615 | + 'categorytree-num-empty' => 'ריקה', |
1602 | 1616 | 'categorytree-load' => 'טעינה', |
1603 | 1617 | 'categorytree-loading' => 'בטעינה', |
1604 | 1618 | 'categorytree-nothing-found' => 'לא נמצאו תוצאות', |
Index: branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -698,12 +698,31 @@ |
699 | 699 | if ( $count !== false && $this->getOption( 'showcount' ) ) { |
700 | 700 | $pages = $pageCount - $subcatCount - $fileCount; |
701 | 701 | |
| 702 | + global $wgContLang, $wgLang; |
702 | 703 | $attr = array( |
703 | | - 'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $subcatCount, $pages , $fileCount, $pageCount, $count ) |
| 704 | + 'title' => wfMsgExt( 'categorytree-member-counts', 'parsemag', $subcatCount, $pages , $fileCount, $pageCount, $count ), |
| 705 | + 'dir' => $wgLang->getDir() # numbers and commas get messed up in a mixed dir env |
704 | 706 | ); |
705 | 707 | |
706 | | - global $wgContLang, $wgLang; |
707 | 708 | $s .= $wgContLang->getDirMark() . ' '; |
| 709 | + |
| 710 | + # Create a list of category members with only non-zero member counts |
| 711 | + $memberNums = array(); |
| 712 | + if ( $subcatCount ) { |
| 713 | + $memberNums[] = wfMessage( 'categorytree-num-categories', $wgLang->formatNum( $subcatCount ) )->text(); |
| 714 | + } |
| 715 | + if ( $pageCount ) { |
| 716 | + $memberNums[] = wfMessage( 'categorytree-num-pages', $wgLang->formatNum( $pageCount ) )->text(); |
| 717 | + } |
| 718 | + if ( $fileCount ) { |
| 719 | + $memberNums[] = wfMessage( 'categorytree-num-files', $wgLang->formatNum( $fileCount ) )->text(); |
| 720 | + } |
| 721 | + $memberNumsShort = $memberNums |
| 722 | + ? $wgLang->commaList( $memberNums ) |
| 723 | + : wfMessage( 'categorytree-num-empty' )->text(); |
| 724 | + |
| 725 | + # Only $5 is actually used in the default message. |
| 726 | + # Other arguments can be used in a customized message. |
708 | 727 | $s .= Xml::tags( 'span', $attr, |
709 | 728 | wfMsgExt( 'categorytree-member-num', |
710 | 729 | array( 'parsemag', 'escapenoentities' ), |
— | — | @@ -711,7 +730,7 @@ |
712 | 731 | $pages, |
713 | 732 | $fileCount, |
714 | 733 | $pageCount, |
715 | | - $wgLang->formatNum( $count ) ) ); |
| 734 | + $memberNumsShort ) ); |
716 | 735 | } |
717 | 736 | |
718 | 737 | $s .= Xml::closeElement( 'div' ); |
Property changes on: branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
719 | 738 | Merged /trunk/extensions/CategoryTree/CategoryTreeFunctions.php:r98140,100023,102786 |
720 | 739 | Merged /trunk/phase3/extensions/CategoryTree/CategoryTreeFunctions.php:r102802,102893 |
Index: branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php |
— | — | @@ -26,5 +26,7 @@ |
27 | 27 | $this->assertEquals( '12,345.56', $this->lang->formatNum( '12345.56' ) ); |
28 | 28 | $this->assertEquals( '12,34,56,79,81,23,45,678', $this->lang->formatNum( '12345679812345678' ) ); |
29 | 29 | $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) ); |
| 30 | + $this->assertEquals( '-12,00,000', $this->lang->formatNum( '-1200000' ) ); |
| 31 | + $this->assertEquals( '-98', $this->lang->formatNum( '-98' ) ); |
30 | 32 | } |
31 | 33 | } |
Index: branches/wmf/1.18wmf1/languages/Language.php |
— | — | @@ -2573,15 +2573,21 @@ |
2574 | 2574 | } |
2575 | 2575 | else { |
2576 | 2576 | // Ref: http://cldr.unicode.org/translation/number-patterns |
| 2577 | + $sign = ""; |
| 2578 | + if ( intval( $_ ) < 0 ) { |
| 2579 | + // For negative numbers apply the algorithm like positive number and add sign. |
| 2580 | + $sign = $_[0]; |
| 2581 | + $_ = substr( $_,1 ); |
| 2582 | + } |
2577 | 2583 | $numberpart = array(); |
2578 | 2584 | $decimalpart = array(); |
2579 | 2585 | $numMatches = preg_match_all( "/(#+)/", $digitGroupingPattern, $matches ); |
2580 | 2586 | preg_match( "/\d+/", $_, $numberpart ); |
2581 | 2587 | preg_match( "/\.\d*/", $_, $decimalpart ); |
2582 | 2588 | $groupedNumber = ( count( $decimalpart ) > 0 ) ? $decimalpart[0]:""; |
2583 | | - if ( $groupedNumber === $_){ |
2584 | | - //the string does not have any number part. Eg: .12345 |
2585 | | - return $groupedNumber; |
| 2589 | + if ( $groupedNumber === $_ ) { |
| 2590 | + // the string does not have any number part. Eg: .12345 |
| 2591 | + return $sign . $groupedNumber; |
2586 | 2592 | } |
2587 | 2593 | $start = $end = strlen( $numberpart[0] ); |
2588 | 2594 | while ( $start > 0 ) |
— | — | @@ -2602,7 +2608,7 @@ |
2603 | 2609 | $groupedNumber = "," . $groupedNumber; |
2604 | 2610 | } |
2605 | 2611 | } |
2606 | | - return $groupedNumber; |
| 2612 | + return $sign . $groupedNumber; |
2607 | 2613 | } |
2608 | 2614 | } |
2609 | 2615 | /** |
Property changes on: branches/wmf/1.18wmf1/languages/Language.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2610 | 2616 | Merged /trunk/phase3/languages/Language.php:r102802 |
Index: branches/wmf/1.18wmf1/languages/Names.php |
— | — | @@ -289,7 +289,7 @@ |
290 | 290 | # 'ruq-grek' => 'Βλαεστε', # Megleno-Romanian (Greek script) |
291 | 291 | 'ruq-latn' => 'Vlăheşte', # Megleno-Romanian (Latin script) |
292 | 292 | 'rw' => 'Kinyarwanda', # Kinyarwanda, should possibly be Kinyarwandi |
293 | | - 'sa' => 'संस्कृत', # Sanskrit |
| 293 | + 'sa' => 'संस्कृतम्', # Sanskrit |
294 | 294 | 'sah' => 'Саха тыла', # Sakha |
295 | 295 | 'sc' => 'Sardu', # Sardinian |
296 | 296 | 'scn' => 'Sicilianu', # Sicilian |