r101298 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101297‎ | r101298 | r101299 >
Date:12:29, 30 October 2011
Author:nikerabbit
Status:ok
Tags:
Comment:
Fixed 1.17 compatability issue
Modified paths:
  • /trunk/extensions/Translate/README (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateUtils.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialMessageGroupStats.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/Translate.php
@@ -15,7 +15,7 @@
1616 /**
1717 * Version number used in extension credits and in other placed where needed.
1818 */
19 -define( 'TRANSLATE_VERSION', '2011-10-27' );
 19+define( 'TRANSLATE_VERSION', '2011-10-30' );
2020
2121 /**
2222 * Extension credits properties.
Index: trunk/extensions/Translate/README
@@ -29,6 +29,8 @@
3030 http://translatewiki.net/docs/Translate/html/
3131
3232 == Change log ==
 33+* 2011-10-30
 34+- Fixed compatibility with MW 1.17
3335 * 2011-10-28
3436 - New configuration variable $wgTranslatePermissionUrl
3537 - Message review feature, available to users in translate-proofr group
Index: trunk/extensions/Translate/specials/SpecialMessageGroupStats.php
@@ -182,7 +182,7 @@
183183 protected function getMainColumnCell( $code, $params ) {
184184 if ( !isset( $this->names ) ) {
185185 global $wgLang;
186 - $this->names = Language::getTranslatedLanguageNames( $wgLang->getCode() );
 186+ $this->names = TranslateUtils::getLanguageNames( $wgLang->getCode() );
187187 $this->translate = SpecialPage::getTitleFor( 'Translate' );
188188 }
189189
Index: trunk/extensions/Translate/TranslateUtils.php
@@ -170,15 +170,7 @@
171171 * @return string
172172 */
173173 public static function languageSelector( $language, $selectedId ) {
174 - if ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) {
175 - $languages = LanguageNames::getNames( $language,
176 - LanguageNames::FALLBACK_NORMAL,
177 - LanguageNames::LIST_MW
178 - );
179 - } else {
180 - $languages = Language::getLanguageNames( false );
181 - }
182 -
 174+ $languages = self::getLanguageNames( $language );
183175 ksort( $languages );
184176
185177 $selector = new XmlSelect( 'language', 'language' );
@@ -191,6 +183,23 @@
192184 }
193185
194186 /**
 187+ * Get translated language names.
 188+ * @return array
 189+ */
 190+ public static function getLanguageNames( /*string */ $code ) {
 191+ if ( is_callable( array( 'Language', 'getTranslatedLanguageNames' ) ) ) {
 192+ return Language::getTranslatedLanguageNames( $code );
 193+ } elseif ( is_callable( array( 'LanguageNames', 'getNames' ) ) ) {
 194+ return LanguageNames::getNames( $code,
 195+ LanguageNames::FALLBACK_NORMAL,
 196+ LanguageNames::LIST_MW
 197+ );
 198+ } else {
 199+ return Language::getLanguageNames( false );
 200+ }
 201+ }
 202+
 203+ /**
195204 * Returns the primary group message belongs to.
196205 * @param $namespace \int
197206 * @param $key \string

Status & tagging log