https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102998
Revision: 102998 Author: nikerabbit Date: 2011-11-14 18:20:08 +0000 (Mon, 14 Nov 2011) Log Message: ----------- MFT r98140 r100023 r102786 r102802 r102893 Modified Paths: -------------- branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php branches/wmf/1.18wmf1/extensions/Babel/BabelAutoCreate.class.php branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTree.i18n.php branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php branches/wmf/1.18wmf1/languages/Language.php branches/wmf/1.18wmf1/languages/Names.php branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php Property Changed: ---------------- branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php branches/wmf/1.18wmf1/languages/Language.php Modified: branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php =================================================================== --- branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -280,20 +280,20 @@ * @return String: Wikitext to add categories. */ protected static function mGenerateCategories( $code, $level ) { - global $wgBabelMainCategory, $wgBabelCategoryNames, $wgLanguageCode; + global $wgBabelMainCategory, $wgBabelCategoryNames; $r = ''; if ( $wgBabelMainCategory !== false && $wgBabelCategoryNames[$level] !== false ) { $category = self::mReplaceCategoryVariables( $wgBabelMainCategory, $code ); $r .= "[[Category:$category|$level]]"; - BabelAutoCreate::create( $category, BabelLanguageCodes::getName( $code, $wgLanguageCode ) ); + BabelAutoCreate::create( $category, $code ); } if ( $wgBabelCategoryNames[$level] !== false ) { $category = self::mReplaceCategoryVariables( $wgBabelCategoryNames[$level], $code ); $r .= "[[Category:$category]]"; - BabelAutoCreate::create( $category, BabelLanguageCodes::getName( $code, $wgLanguageCode ), $level ); + BabelAutoCreate::create( $category, $code, $level ); } return $r; Modified: branches/wmf/1.18wmf1/extensions/Babel/BabelAutoCreate.class.php =================================================================== --- branches/wmf/1.18wmf1/extensions/Babel/BabelAutoCreate.class.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/extensions/Babel/BabelAutoCreate.class.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -23,19 +23,21 @@ * Create category. * * @param $category String: Name of category to create. - * @param $language String: Name of language that the category is for. + * @param $code String: Code of language that the category is for. * @param $level String: Level that the category is for. */ - public static function create( $category, $language, $level = null ) { + public static function create( $category, $code, $level = null ) { $category = strip_tags( $category ); $title = Title::makeTitleSafe( NS_CATEGORY, $category ); if ( $title === null || $title->exists() ) { return; } + global $wgLanguageCode; + $language = BabelLanguageCodes::getName( $code, $wgLanguageCode ); if ( $level === null ) { - $text = wfMsgForContent( 'babel-autocreate-text-main', $language ); + $text = wfMsgForContent( 'babel-autocreate-text-main', $language, $code ); } else { - $text = wfMsgForContent( 'babel-autocreate-text-levels', $level, $language ); + $text = wfMsgForContent( 'babel-autocreate-text-levels', $level, $language, $code ); } $article = new Article( $title, 0 ); Modified: branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTree.i18n.php =================================================================== --- branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTree.i18n.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTree.i18n.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -38,7 +38,11 @@ '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…', @@ -62,6 +66,7 @@ * @author The Evil IP address * @author Александр Сигачёв * @author פוילישער + * @author Amire80 */ $messages['qqq'] = array( 'categorytree' => 'Title of [[Special:CategoryTree]]', @@ -90,6 +95,11 @@ * $4 = total number of members, * $5 = members to be shown in the tree, depending on mode. Use with { {PLURAL} }', + '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', @@ -1598,6 +1608,10 @@ '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' => 'לא נמצאו תוצאות', Modified: branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php =================================================================== --- branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -698,12 +698,31 @@ 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' ), @@ -711,7 +730,7 @@ $pages, $fileCount, $pageCount, - $wgLang->formatNum( $count ) ) ); + $memberNumsShort ) ); } $s .= Xml::closeElement( 'div' ); Property changes on: branches/wmf/1.18wmf1/extensions/CategoryTree/CategoryTreeFunctions.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php:67183 + /branches/wmf/1.16wmf4/extensions/CategoryTree/CategoryTreeFunctions.php:67183 /trunk/extensions/CategoryTree/CategoryTreeFunctions.php:98140,100023,102786 /trunk/phase3/extensions/CategoryTree/CategoryTreeFunctions.php:102802,102893 Modified: branches/wmf/1.18wmf1/languages/Language.php =================================================================== --- branches/wmf/1.18wmf1/languages/Language.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/languages/Language.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -2573,15 +2573,21 @@ } else { // Ref: http://cldr.unicode.org/translation/number-patterns + $sign = ""; + if ( intval( $_ ) < 0 ) { + // For negative numbers apply the algorithm like positive number and add sign. + $sign = $_[0]; + $_ = substr( $_,1 ); + } $numberpart = array(); $decimalpart = array(); $numMatches = preg_match_all( "/(#+)/", $digitGroupingPattern, $matches ); preg_match( "/\d+/", $_, $numberpart ); preg_match( "/\.\d*/", $_, $decimalpart ); $groupedNumber = ( count( $decimalpart ) > 0 ) ? $decimalpart[0]:""; - if ( $groupedNumber === $_){ - //the string does not have any number part. Eg: .12345 - return $groupedNumber; + if ( $groupedNumber === $_ ) { + // the string does not have any number part. Eg: .12345 + return $sign . $groupedNumber; } $start = $end = strlen( $numberpart[0] ); while ( $start > 0 ) @@ -2602,7 +2608,7 @@ $groupedNumber = "," . $groupedNumber; } } - return $groupedNumber; + return $sign . $groupedNumber; } } /** Property changes on: branches/wmf/1.18wmf1/languages/Language.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/REL1_15/phase3/languages/Language.php:51646 /branches/REL1_17/phase3/languages/Language.php:81445,81448 /branches/new-installer/phase3/languages/Language.php:43664-66004 /branches/nikola/phase3/languages/Language.php:85224,85239,85308 /branches/sqlite/languages/Language.php:58211-58321 /trunk/phase3/languages/Language.php:92580,92713,92765,92884,92886-92887,92894,92898,92907,92932,93149,93151,93233-93234,93258,93266,93516-93518,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94346,94372,94422,94425,94444,94448,94456,94498,94601,94630,94728,94825,94862,94995-94997,95042,95155,95332,95410,95442,95468,95601,95812,99154 + /branches/REL1_15/phase3/languages/Language.php:51646 /branches/REL1_17/phase3/languages/Language.php:81445,81448 /branches/new-installer/phase3/languages/Language.php:43664-66004 /branches/nikola/phase3/languages/Language.php:85224,85239,85308 /branches/sqlite/languages/Language.php:58211-58321 /trunk/phase3/languages/Language.php:92580,92713,92765,92884,92886-92887,92894,92898,92907,92932,93149,93151,93233-93234,93258,93266,93516-93518,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94346,94372,94422,94425,94444,94448,94456,94498,94601,94630,94728,94825,94862,94995-94997,95042,95155,95332,95410,95442,95468,95601,95812,99154,102802 Modified: branches/wmf/1.18wmf1/languages/Names.php =================================================================== --- branches/wmf/1.18wmf1/languages/Names.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/languages/Names.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -289,7 +289,7 @@ # 'ruq-grek' => 'Βλαεστε', # Megleno-Romanian (Greek script) 'ruq-latn' => 'Vlăheşte', # Megleno-Romanian (Latin script) 'rw' => 'Kinyarwanda', # Kinyarwanda, should possibly be Kinyarwandi - 'sa' => 'संस्कृत', # Sanskrit + 'sa' => 'संस्कृतम्', # Sanskrit 'sah' => 'Саха тыла', # Sakha 'sc' => 'Sardu', # Sardinian 'scn' => 'Sicilianu', # Sicilian Modified: branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php =================================================================== --- branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php 2011-11-14 18:05:55 UTC (rev 102997) +++ branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php 2011-11-14 18:20:08 UTC (rev 102998) @@ -26,5 +26,7 @@ $this->assertEquals( '12,345.56', $this->lang->formatNum( '12345.56' ) ); $this->assertEquals( '12,34,56,79,81,23,45,678', $this->lang->formatNum( '12345679812345678' ) ); $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) ); + $this->assertEquals( '-12,00,000', $this->lang->formatNum( '-1200000' ) ); + $this->assertEquals( '-98', $this->lang->formatNum( '-98' ) ); } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs