r113064 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113063‎ | r113064 | r113065 >
Date:19:17, 5 March 2012
Author:reedy
Status:ok
Tags:
Comment:
Add to documentation

Add a couple of braces

Update code calling Language related deprecated code
Modified paths:
  • /trunk/phase3/languages/Language.php (modified) (history)
  • /trunk/phase3/languages/LanguageConverter.php (modified) (history)
  • /trunk/phase3/languages/classes/LanguageKu.php (modified) (history)
  • /trunk/phase3/languages/classes/LanguagePl.php (modified) (history)
  • /trunk/phase3/languages/classes/LanguageSr.php (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/LanguageConverter.php
@@ -72,7 +72,7 @@
7373 $this->mMainLanguageCode = $maincode;
7474 $this->mVariants = array_diff( $variants, $wgDisabledVariants );
7575 $this->mVariantFallbacks = $variantfallbacks;
76 - $this->mVariantNames = Language::getLanguageNames();
 76+ $this->mVariantNames = Language::fetchLanguageNames();
7777 $this->mCacheKey = wfMemcKey( 'conversiontables', $maincode );
7878 $defaultflags = array(
7979 // 'S' show converted text
@@ -626,6 +626,7 @@
627627 * @param $startPos int
628628 * @param $depth Integer: depth of recursion
629629 *
 630+ * @throws MWException
630631 * @return String: converted text
631632 */
632633 protected function recursiveConvertRule( $text, $variant, &$startPos, $depth = 0 ) {
@@ -796,6 +797,7 @@
797798 * This method must be implemented in derived class.
798799 *
799800 * @private
 801+ * @throws MWException
800802 */
801803 function loadDefaultTables() {
802804 $name = get_class( $this );
Index: trunk/phase3/languages/Language.php
@@ -158,6 +158,7 @@
159159 /**
160160 * Create a language object for a given language code
161161 * @param $code String
 162+ * @throws MWException
162163 * @return Language
163164 */
164165 protected static function newFromCode( $code ) {
@@ -559,7 +560,7 @@
560561 if ( $usemsg && wfMessage( $msg )->exists() ) {
561562 return $this->getMessageFromDB( $msg );
562563 }
563 - $name = self::getLanguageName( $code );
 564+ $name = self::fetchLanguageName( $code );
564565 if ( $name ) {
565566 return $name; # if it's defined as a language name, show that
566567 } else {
@@ -2538,6 +2539,7 @@
25392540 * @param $file string
25402541 * @param $string string
25412542 *
 2543+ * @throws MWException
25422544 * @return string
25432545 */
25442546 function transformUsingPairFile( $file, $string ) {
@@ -3576,6 +3578,7 @@
35773579 * @param $prefix string Prepend this to the filename
35783580 * @param $code string Language code
35793581 * @param $suffix string Append this to the filename
 3582+ * @throws MWException
35803583 * @return string $prefix . $mangledCode . $suffix
35813584 */
35823585 public static function getFileName( $prefix = 'Language', $code, $suffix = '.php' ) {
Index: trunk/phase3/languages/classes/LanguagePl.php
@@ -15,14 +15,16 @@
1616 if ( !count( $forms ) ) { return ''; }
1717 $forms = $this->preConvertPlural( $forms, 3 );
1818 $count = abs( $count );
19 - if ( $count == 1 )
20 - return $forms[0]; // singular
 19+ if ( $count == 1 ) {
 20+ return $forms[0]; // singular
 21+ }
2122 switch ( $count % 10 ) {
2223 case 2:
2324 case 3:
2425 case 4:
25 - if ( $count / 10 % 10 != 1 )
 26+ if ( $count / 10 % 10 != 1 ) {
2627 return $forms[1]; // plural
 28+ }
2729 default:
2830 return $forms[2]; // plural genitive
2931 }
Index: trunk/phase3/languages/classes/LanguageKu.php
@@ -196,6 +196,7 @@
197197 * @param $text string
198198 * @param $toVariant bool
199199 *
 200+ * @throws MWException
200201 * @return string
201202 */
202203 function translate( $text, $toVariant ) {
Index: trunk/phase3/languages/classes/LanguageSr.php
@@ -147,6 +147,7 @@
148148 * @param $text string
149149 * @param $toVariant string
150150 *
 151+ * @throws MWException
151152 * @return string
152153 */
153154 function translate( $text, $toVariant ) {

Status & tagging log