r98144 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98143‎ | r98144 | r98145 >
Date:17:21, 26 September 2011
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Narayam/js/ext.narayam.core.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/Narayam/js/ext.narayam.rules.ne.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /branches/wmf/1.18wmf1/includes/LocalisationCache.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/Language.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesAs.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesBn.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesEn.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesGu.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesHi.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesKn.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesMl.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesMr.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesOr.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesPa.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesSa.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesTa.php (modified) (history)
  • /branches/wmf/1.18wmf1/languages/messages/MessagesTe.php (modified) (history)
  • /branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php (added) (history)
  • /branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageNlTest.php (added) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/Narayam/js/ext.narayam.core.js
@@ -53,13 +53,19 @@
5454 var rules = currentScheme.extended_keyboard && useExtended ?
5555 currentScheme.rules_x : currentScheme.rules;
5656 for ( var i = 0; i < rules.length; i++ ) {
57 - var keyBufferMatch = true;
58 - if ( rules[i][1].length > 0 && rules[i][1].length <= keyBuffer.length ) {
59 - // Try to match rules[i][1] at the end of the key buffer
60 - keyBufferMatch = new RegExp( rules[i][1] + '$' ).test( keyBuffer );
61 - }
6257 var regex = new RegExp( rules[i][0] + '$' );
63 - if ( keyBufferMatch && regex.test( str ) ) {
 58+ if ( regex.test( str ) // Input string match
 59+ &&
 60+ (
 61+ rules[i][1].length == 0 // Keybuffer match not required
 62+ ||
 63+ ( // Keybuffer match specified, so it should be met
 64+ rules[i][1].length > 0
 65+ && rules[i][1].length <= keyBuffer.length
 66+ && new RegExp( rules[i][1] + '$' ).test( keyBuffer )
 67+ )
 68+ )
 69+ ) {
6470 return str.replace( regex, rules[i][2] );
6571 }
6672 }
Index: branches/wmf/1.18wmf1/extensions/Narayam/js/ext.narayam.rules.ne.js
@@ -12,7 +12,7 @@
1313
1414 ['([क-ह]़?)्a', '','$1'],
1515 ['([क-ह]़?)्A', '','$1ा'],
16 -['([क-ह]़?)a', '','$1ा'],
 16+['([क-ह]़?)्a', '','$1ा'],
1717 ['([क-ह]़?)्i', '','$1ि'],
1818 ['([क-ह]़?)(्I|िi|ेe)', '','$1ी'],
1919 ['([क-ह]़?)्u', '','$1ु'],
@@ -52,14 +52,14 @@
5353 ['ऒ\\^', '','ओ'],
5454 ['अu', '','औ'],
5555 ['र्र्r', '','र्‍'],
56 -['ड़्h', '','ढ़्'],
 56+['ड़्h', '','ढ्'],
5757 ['ऋR', '','ॠ'],
5858 ['ळ्l', '','ऌ'],
5959 ['ऌl', '','ॡ'],
6060 ['ं\\^', '','ँ'],
6161 ['ंM', '','ँ'],
6262 ['ओM', '','ॐ'],
63 -['ड्D', '','ड़्'],
 63+['ड्D', '','ड्'],
6464 ['क्h', '','ख्'],
6565 ['ग्h', '','घ्'],
6666 ['G', '','ङ्'],
@@ -72,22 +72,22 @@
7373 ['द्h', '','ध्'],
7474 ['प्h', '','फ्'],
7575 ['ब्h', '','भ्'],
76 -['ऋa', '','ऱ'],
77 -['ऋA', '','ऱा'],
78 -['ऋi', '','ऱि'],
79 -['ऋI', '','ऱी'],
80 -['ऋu', '','ऱु'],
81 -['ऋU', '','ऱू'],
82 -['ऋ\\^', '','ऱॅ'],
83 -['ऋe', '','ऱे'],
84 -['ऋE', '','ऱे'],
85 -['ऋo', '','ऱो'],
86 -['ऋO', '','ऱो'],
87 -['ऋ\\~', '','ऱ्'],
 76+['ऋa', '','र'],
 77+['ऋA', '','रा'],
 78+['ऋi', '','रि'],
 79+['ऋI', '','री'],
 80+['ऋu', '','रु'],
 81+['ऋU', '','रू'],
 82+['ऋ\\^', '','ऋ'],
 83+['ऋe', '','रे'],
 84+['ऋE', '','रे'],
 85+['ऋo', '','रो'],
 86+['ऋO', '','रो'],
 87+['ऋ\\~', '','र्'],
8888
8989 ['स्h', '','श्'],
9090 ['श्h', '','ष्'],
91 -['क़्h', '','ख़्'],
 91+['क़्h', '','ख्'],
9292 ['ज़्h', '','ऴ्'],
9393 ['।\\.', '','॥'],
9494
@@ -96,7 +96,7 @@
9797 ['c', '','क्'],
9898 ['d', '','द्'],
9999 ['e', '','ए'],
100 -['(f|F)', '','फ़्'],
 100+['(f|F)', '','फ्'],
101101 ['g', '','ग्'],
102102 ['h', '','ह्'],
103103 ['i', '','इ'],
@@ -131,11 +131,12 @@
132132 ['N', '','ण्'],
133133 ['O', '','ओ'],
134134 ['P', '','प्प्'],
 135+['Q', '','अ'],
135136 ['R', '','ऋ'],
136137 ['S', '','श्'],
137138 ['T', '','ट्'],
138139 ['U', '','ऊ'],
139 -['V', '','व्व्'],
 140+['V', '','झ्'],
140141 ['W', '','औ'],
141142 ['X', '','क्ष्'],
142143 ['Y', '','य्य्'],
@@ -151,7 +152,7 @@
152153 ['9', '','९'],
153154 ['\\.', '','।'],
154155 ['//', '','ऽ'],
155 -['\\`', '','़']
 156+['\\`', '','्']
156157 ];
157158
158159 jQuery.narayam.addScheme( 'ne', {
Index: branches/wmf/1.18wmf1/extensions/UploadWizard/UploadWizard.i18n.php
@@ -112,7 +112,7 @@
113113 'mwe-upwiz-source-thirdparty-cases' => 'Now tell us why you are sure this site has the right to publish {{PLURAL:$1|this work|these works}}:',
114114 'mwe-upwiz-source-thirdparty-accept' => 'OK',
115115 'mwe-upwiz-source-custom' => 'Provide copyright information for each file individually on the next page.',
116 - 'mwe-upwiz-more-options' => 'more options...',
 116+ 'mwe-upwiz-more-options' => 'add categories and more information...',
117117 'mwe-upwiz-fewer-options' => 'fewer options...',
118118 'mwe-upwiz-desc' => 'Description',
119119 'mwe-upwiz-desc-add-n' => 'add a description in another language',
Index: branches/wmf/1.18wmf1/extensions/Babel/Babel.class.php
@@ -199,7 +199,7 @@
200200 */
201201 protected static function mGenerateBox( $code, $level ) {
202202 $lang = wfBCP47( $code );
203 - $portal = wfMessage( 'babel-portal', $code )->plain();
 203+ $portal = wfMessage( 'babel-portal', $code )->inContentLanguage()->plain();
204204 if ( $portal !== '' ) {
205205 $portal = "[[$portal|$lang]]";
206206 } else {
Index: branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php
@@ -0,0 +1,30 @@
 2+<?php
 3+/**
 4+ * @author Santhosh Thottingal
 5+ * @copyright Copyright © 2011, Santhosh Thottingal
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/LanguageMl.php */
 10+class LanguageMlTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'Ml' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ /** see bug 29495 */
 21+ function testFormatNum() {
 22+ $this->assertEquals( '12,34,567', $this->lang->formatNum( '1234567' ) );
 23+ $this->assertEquals( '12,345', $this->lang->formatNum( '12345' ) );
 24+ $this->assertEquals( '1', $this->lang->formatNum( '1' ) );
 25+ $this->assertEquals( '123', $this->lang->formatNum( '123' ) );
 26+ $this->assertEquals( '1,234', $this->lang->formatNum( '1234' ) );
 27+ $this->assertEquals( '12,345.56', $this->lang->formatNum( '12345.56' ) );
 28+ $this->assertEquals( '12,34,56,79,81,23,45,678', $this->lang->formatNum( '12345679812345678' ) );
 29+ $this->assertEquals( '.12345', $this->lang->formatNum( '.12345' ) );
 30+ }
 31+}
Property changes on: branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageMlTest.php
___________________________________________________________________
Added: svn:eol-style
132 + native
Index: branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageNlTest.php
@@ -0,0 +1,28 @@
 2+<?php
 3+/**
 4+ * @author Santhosh Thottingal
 5+ * @copyright Copyright © 2011, Santhosh Thottingal
 6+ * @file
 7+ */
 8+
 9+/** Tests for MediaWiki languages/LanguageNl.php */
 10+class LanguageNlTest extends MediaWikiTestCase {
 11+ private $lang;
 12+
 13+ function setUp() {
 14+ $this->lang = Language::factory( 'Nl' );
 15+ }
 16+ function tearDown() {
 17+ unset( $this->lang );
 18+ }
 19+
 20+ function testFormatNum() {
 21+ $this->assertEquals( '1.234.567', $this->lang->formatNum( '1234567' ) );
 22+ $this->assertEquals( '12.345', $this->lang->formatNum( '12345' ) );
 23+ $this->assertEquals( '1', $this->lang->formatNum( '1' ) );
 24+ $this->assertEquals( '123', $this->lang->formatNum( '123' ) );
 25+ $this->assertEquals( '1.234', $this->lang->formatNum( '1234' ) );
 26+ $this->assertEquals( '12.345,56', $this->lang->formatNum( '12345.56' ) );
 27+ $this->assertEquals( ',1234556', $this->lang->formatNum( '.1234556' ) );
 28+ }
 29+}
Property changes on: branches/wmf/1.18wmf1/tests/phpunit/languages/LanguageNlTest.php
___________________________________________________________________
Added: svn:eol-style
130 + native
Index: branches/wmf/1.18wmf1/includes/LocalisationCache.php
@@ -88,6 +88,7 @@
8989 'dateFormats', 'datePreferences', 'datePreferenceMigrationMap',
9090 'defaultDateFormat', 'extraUserToggles', 'specialPageAliases',
9191 'imageFiles', 'preloadedMessages', 'namespaceGenderAliases',
 92+ 'digitGroupingPattern'
9293 );
9394
9495 /**
Index: branches/wmf/1.18wmf1/languages/messages/MessagesMr.php
@@ -295,6 +295,8 @@
296296
297297 $linkTrail = "/^([\xE0\xA4\x80-\xE0\xA5\xA3\xE0\xA5\xB1-\xE0\xA5\xBF\xEF\xBB\xBF\xE2\x80\x8D]+)(.*)$/sDu";
298298
 299+$digitGroupingPattern = "##,##,###";
 300+
299301 $messages = array(
300302 # User preference toggles
301303 'tog-underline' => 'दुव्यांना अधोरेखित करा:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesHi.php
@@ -68,6 +68,8 @@
6969 );
7070 $linkTrail = "/^([a-z]+)(.*)$/sD";
7171
 72+$digitGroupingPattern = "##,##,###";
 73+
7274 $messages = array(
7375 # User preference toggles
7476 'tog-underline' => 'कड़ियाँ अधोरेखन:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesKn.php
@@ -52,6 +52,8 @@
5353 '9' => '೯', # &#x0cef;
5454 );
5555
 56+$digitGroupingPattern = "##,##,###";
 57+
5658 $messages = array(
5759 # User preference toggles
5860 'tog-underline' => 'ಲಿಂಕುಗಳ ಕೆಳಗೆ ಗೆರೆ ತೋರಿಸಿ',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesEn.php
@@ -3648,10 +3648,15 @@
36493649
36503650 # Video information, used by Language::formatTimePeriod() to format lengths in the above messages
36513651 'video-dims' => '$1, $2×$3', # only translate this message to other languages if you have to change it
3652 -'seconds-abbrev' => 's', # only translate this message to other languages if you have to change it
3653 -'minutes-abbrev' => 'm', # only translate this message to other languages if you have to change it
3654 -'hours-abbrev' => 'h', # only translate this message to other languages if you have to change it
3655 -'days-abbrev' => 'd', # only translate this message to other languages if you have to change it
 3652+'seconds-abbrev' => '$1s', # only translate this message to other languages if you have to change it
 3653+'minutes-abbrev' => '$1m', # only translate this message to other languages if you have to change it
 3654+'hours-abbrev' => '$1h', # only translate this message to other languages if you have to change it
 3655+'days-abbrev' => '$1d', # only translate this message to other languages if you have to change it
 3656+'seconds' => '{{PLURAL:$1|$1 second|$1 seconds}}',
 3657+'minutes' => '{{PLURAL:$1|$1 minute|$1 minutes}}',
 3658+'hours' => '{{PLURAL:$1|$1 hour|$1 hours}}',
 3659+'days' => '{{PLURAL:$1|$1 day|$1 days}}',
 3660+'ago' => '$1 ago',
36563661
36573662 # Bad image list
36583663 'bad_image_list' => 'The format is as follows:
Index: branches/wmf/1.18wmf1/languages/messages/MessagesAs.php
@@ -108,6 +108,8 @@
109109 '9' => '৯', # &#x09ef;
110110 );
111111
 112+$digitGroupingPattern = "##,##,###";
 113+
112114 $messages = array(
113115 # User preference toggles
114116 'tog-underline' => 'সংযোগ সমূহ অধোৰেখিত কৰক:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesMl.php
@@ -315,6 +315,8 @@
316316 'url_query' => array( '0', 'ക്വറി', 'QUERY' ),
317317 );
318318
 319+$digitGroupingPattern = "##,##,###";
 320+
319321 $messages = array(
320322 # User preference toggles
321323 'tog-underline' => 'കണ്ണികൾക്ക് അടിവരയിടുക:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesBn.php
@@ -61,6 +61,8 @@
6262 '9' => '৯'
6363 );
6464
 65+$digitGroupingPattern = "##,##,###";
 66+
6567 $messages = array(
6668 # User preference toggles
6769 'tog-underline' => 'সংযোগগুলির নিচে দাগ দেখানো হোক:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesSa.php
@@ -267,6 +267,8 @@
268268 'protectionlevel' => array( '1', 'रक्षास्तर', 'PROTECTIONLEVEL' ),
269269 );
270270
 271+$digitGroupingPattern = "##,##,###";
 272+
271273 $messages = array(
272274 # User preference toggles
273275 'tog-underline' => 'संबंधनानि अधोरेखितानि करोतु',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesOr.php
@@ -241,6 +241,8 @@
242242 'url_query' => array( '0', 'ପ୍ରଶ୍ନ', 'QUERY' ),
243243 );
244244
 245+$digitGroupingPattern = "##,##,###";
 246+
245247 $messages = array(
246248 # User preference toggles
247249 'tog-underline' => 'ତଳେ ଥିବା ଲିଙ୍କ:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesPa.php
@@ -48,6 +48,8 @@
4949 );
5050 $linkTrail = '/^([ਁਂਃਅਆਇਈਉਊਏਐਓਔਕਖਗਘਙਚਛਜਝਞਟਠਡਢਣਤਥਦਧਨਪਫਬਭਮਯਰਲਲ਼ਵਸ਼ਸਹ਼ਾਿੀੁੂੇੈੋੌ੍ਖ਼ਗ਼ਜ਼ੜਫ਼ੰੱੲੳa-z]+)(.*)$/sDu';
5151
 52+$digitGroupingPattern = "##,##,###";
 53+
5254 $messages = array(
5355 # User preference toggles
5456 'tog-underline' => 'ਅੰਡਰ-ਲਾਈਨ ਲਿੰਕ:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesGu.php
@@ -134,6 +134,8 @@
135135 '9' => '૯', # &#x0aef;
136136 );
137137
 138+$digitGroupingPattern = "##,##,###";
 139+
138140 $messages = array(
139141 # User preference toggles
140142 'tog-underline' => 'કડીઓની નીચે લીટી (અંડરલાઇન) ઉમેરો:',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesTa.php
@@ -68,6 +68,8 @@
6969
7070 $linkTrail = "/^([\xE0\xAE\x80-\xE0\xAF\xBF]+)(.*)$/sDu";
7171
 72+$digitGroupingPattern = "##,##,###";
 73+
7274 $messages = array(
7375 # User preference toggles
7476 'tog-underline' => 'இணைப்புகளுக்கு அடிக்கோடிடு',
Index: branches/wmf/1.18wmf1/languages/messages/MessagesTe.php
@@ -138,6 +138,8 @@
139139
140140 $linkTrail = "/^([\xE0\xB0\x81-\xE0\xB1\xAF]+)(.*)$/sDu";
141141
 142+$digitGroupingPattern = "##,##,###";
 143+
142144 $messages = array(
143145 # User preference toggles
144146 'tog-underline' => 'లంకె క్రీగీత:',
Index: branches/wmf/1.18wmf1/languages/Language.php
@@ -2560,13 +2560,57 @@
25612561
25622562 /**
25632563 * Adds commas to a given number
2564 - *
 2564+ * @since 1.19
25652565 * @param $_ mixed
25662566 * @return string
25672567 */
25682568 function commafy( $_ ) {
2569 - return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
 2569+ $digitGroupingPattern = $this->digitGroupingPattern();
 2570+
 2571+ if ( !$digitGroupingPattern || $digitGroupingPattern === "###,###,###" ) {
 2572+ //default grouping is at thousands, use the same for ###,###,### pattern too.
 2573+ return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
 2574+ }
 2575+ else {
 2576+ // Ref: http://cldr.unicode.org/translation/number-patterns
 2577+ $numberpart = array();
 2578+ $decimalpart = array();
 2579+ $numMatches = preg_match_all( "/(#+)/", $digitGroupingPattern, $matches );
 2580+ preg_match( "/\d+/", $_, $numberpart );
 2581+ preg_match( "/\.\d*/", $_, $decimalpart );
 2582+ $groupedNumber = ( count( $decimalpart ) > 0 ) ? $decimalpart[0]:"";
 2583+ if ( $groupedNumber === $_){
 2584+ //the string does not have any number part. Eg: .12345
 2585+ return $groupedNumber;
 2586+ }
 2587+ $start = $end = strlen( $numberpart[0] );
 2588+ while ( $start > 0 )
 2589+ {
 2590+ $match = $matches[0][$numMatches -1] ;
 2591+ $matchLen = strlen( $match );
 2592+ $start = $end - $matchLen;
 2593+ if ( $start < 0 ) {
 2594+ $start = 0;
 2595+ }
 2596+ $groupedNumber = substr( $_ , $start, $end -$start ) . $groupedNumber ;
 2597+ $end = $start;
 2598+ if ( $numMatches > 1 ) {
 2599+ // use the last pattern for the rest of the number
 2600+ $numMatches--;
 2601+ }
 2602+ if ( $start > 0 ) {
 2603+ $groupedNumber = "," . $groupedNumber;
 2604+ }
 2605+ }
 2606+ return $groupedNumber;
 2607+ }
25702608 }
 2609+ /**
 2610+ * @return String
 2611+ */
 2612+ function digitGroupingPattern() {
 2613+ return self::$dataCache->getItem( $this->mCode, 'digitGroupingPattern' );
 2614+ }
25712615
25722616 /**
25732617 * @return array
@@ -3427,18 +3471,34 @@
34283472 /**
34293473 * @todo Document
34303474 * @param $seconds int|float
3431 - * @param $format String Optional, one of ("avoidseconds","avoidminutes"):
3432 - * "avoidseconds" - don't mention seconds if $seconds >= 1 hour
3433 - * "avoidminutes" - don't mention seconds/minutes if $seconds > 48 hours
 3475+ * @param $format Array Optional
 3476+ * If $format['avoid'] == 'avoidseconds' - don't mention seconds if $seconds >= 1 hour
 3477+ * If $format['avoid'] == 'avoidminutes' - don't mention seconds/minutes if $seconds > 48 hours
 3478+ * If $format['noabbrevs'] is true - use 'seconds' and friends instead of 'seconds-abbrev' and friends
 3479+ * For backwards compatibility, $format may also be one of the strings 'avoidseconds' or 'avoidminutes'
34343480 * @return string
34353481 */
3436 - function formatTimePeriod( $seconds, $format = false ) {
 3482+ function formatTimePeriod( $seconds, $format = array() ) {
 3483+ if ( !is_array( $format ) ) {
 3484+ $format = array( 'avoid' => $format, 'noabbrevs' => false ); // For backwards compatibility
 3485+ }
 3486+ if ( !isset( $format['avoid'] ) ) {
 3487+ $format['avoid'] = false;
 3488+ }
 3489+ if ( !isset( $format['noabbrevs' ] ) ) {
 3490+ $format['noabbrevs'] = false;
 3491+ }
 3492+ $secondsMsg = wfMessage( $format['noabbrevs'] ? 'seconds' : 'seconds-abbrev' )->inLanguage( $this );
 3493+ $minutesMsg = wfMessage( $format['noabbrevs'] ? 'minutes' : 'minutes-abbrev' )->inLanguage( $this );
 3494+ $hoursMsg = wfMessage( $format['noabbrevs'] ? 'hours' : 'hours-abbrev' )->inLanguage( $this );
 3495+ $daysMsg = wfMessage( $format['noabbrevs'] ? 'days' : 'days-abbrev' )->inLanguage( $this );
 3496+
34373497 if ( round( $seconds * 10 ) < 100 ) {
34383498 $s = $this->formatNum( sprintf( "%.1f", round( $seconds * 10 ) / 10 ) );
3439 - $s .= $this->getMessageFromDB( 'seconds-abbrev' );
 3499+ $s = $secondsMsg->params( $s )->text();
34403500 } elseif ( round( $seconds ) < 60 ) {
34413501 $s = $this->formatNum( round( $seconds ) );
3442 - $s .= $this->getMessageFromDB( 'seconds-abbrev' );
 3502+ $s = $secondsMsg->params( $s )->text();
34433503 } elseif ( round( $seconds ) < 3600 ) {
34443504 $minutes = floor( $seconds / 60 );
34453505 $secondsPart = round( fmod( $seconds, 60 ) );
@@ -3446,9 +3506,9 @@
34473507 $secondsPart = 0;
34483508 $minutes++;
34493509 }
3450 - $s = $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' );
 3510+ $s = $minutesMsg->params( $this->formatNum( $minutes ) )->text();
34513511 $s .= ' ';
3452 - $s .= $this->formatNum( $secondsPart ) . $this->getMessageFromDB( 'seconds-abbrev' );
 3512+ $s .= $secondsMsg->params( $this->formatNum( $secondsPart ) )->text();
34533513 } elseif ( round( $seconds ) <= 2*86400 ) {
34543514 $hours = floor( $seconds / 3600 );
34553515 $minutes = floor( ( $seconds - $hours * 3600 ) / 60 );
@@ -3461,25 +3521,24 @@
34623522 $minutes = 0;
34633523 $hours++;
34643524 }
3465 - $s = $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' );
 3525+ $s = $hoursMsg->params( $this->formatNum( $hours ) )->text();
34663526 $s .= ' ';
3467 - $s .= $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' );
3468 - if ( !in_array( $format, array( 'avoidseconds', 'avoidminutes' ) ) ) {
3469 - $s .= ' ' . $this->formatNum( $secondsPart ) .
3470 - $this->getMessageFromDB( 'seconds-abbrev' );
 3527+ $s .= $minutesMsg->params( $this->formatNum( $minutes ) )->text();
 3528+ if ( !in_array( $format['avoid'], array( 'avoidseconds', 'avoidminutes' ) ) ) {
 3529+ $s .= ' ' . $secondsMsg->params( $this->formatNum( $secondsPart ) )->text();
34713530 }
34723531 } else {
34733532 $days = floor( $seconds / 86400 );
3474 - if ( $format === 'avoidminutes' ) {
 3533+ if ( $format['avoid'] === 'avoidminutes' ) {
34753534 $hours = round( ( $seconds - $days * 86400 ) / 3600 );
34763535 if ( $hours == 24 ) {
34773536 $hours = 0;
34783537 $days++;
34793538 }
3480 - $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' );
 3539+ $s = $daysMsg->params( $this->formatNum( $days ) )->text();
34813540 $s .= ' ';
3482 - $s .= $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' );
3483 - } elseif ( $format === 'avoidseconds' ) {
 3541+ $s .= $hoursMsg->params( $this->formatNum( $hours ) )->text();
 3542+ } elseif ( $format['avoid'] === 'avoidseconds' ) {
34843543 $hours = floor( ( $seconds - $days * 86400 ) / 3600 );
34853544 $minutes = round( ( $seconds - $days * 86400 - $hours * 3600 ) / 60 );
34863545 if ( $minutes == 60 ) {
@@ -3490,13 +3549,13 @@
34913550 $hours = 0;
34923551 $days++;
34933552 }
3494 - $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' );
 3553+ $s = $daysMsg->params( $this->formatNum( $days ) )->text();
34953554 $s .= ' ';
3496 - $s .= $this->formatNum( $hours ) . $this->getMessageFromDB( 'hours-abbrev' );
 3555+ $s .= $hoursMsg->params( $this->formatNum( $hours ) )->text();
34973556 $s .= ' ';
3498 - $s .= $this->formatNum( $minutes ) . $this->getMessageFromDB( 'minutes-abbrev' );
 3557+ $s .= $minutesMsg->params( $this->formatNum( $minutes ) )->text();
34993558 } else {
3500 - $s = $this->formatNum( $days ) . $this->getMessageFromDB( 'days-abbrev' );
 3559+ $s = $daysMsg->params( $this->formatNum( $days ) )->text();
35013560 $s .= ' ';
35023561 $s .= $this->formatTimePeriod( $seconds - $days * 86400, $format );
35033562 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97606Narayam: Blank keybuffer was matching against rules that require keybuffer ma...junaidpv08:56, 20 September 2011
r97609Narayam: Update Nepali transliteration using rules from Nepali wikipedia.junaidpv09:16, 20 September 2011
r97644Tweak 'mwe-upwiz-more-options' per suggestion of Wouter Hagens.siebrand16:45, 20 September 2011
r97793Add support for Number grouping(commafy) based on CLDR number grouping patter...santhosh05:01, 22 September 2011
r97804Add number grouping pattern. Ref Bug 29495. Ml and Hi added in r97793santhosh09:21, 22 September 2011
r97962Make Language::formatTimePeriod() more flexible so it can produce stuff like ...catrope22:17, 23 September 2011
r98006Per CR on r97962, introduce an array parameter for formatTimePeriod() rather ...catrope15:44, 24 September 2011
r98023Followup r97726 - this should not depend on user languagenikerabbit20:22, 24 September 2011

Comments

#Comment by Catrope (talk | contribs)   23:45, 26 September 2011

Of course I meant to say 1.18wmf1 in the commit summary.

#Comment by Liangent (talk | contribs)   14:56, 11 November 2011

r97793 is causing bugs.

Status & tagging log