r26249 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26248‎ | r26249 | r26250 >
Date:11:30, 30 September 2007
Author:nikerabbit
Status:old
Tags:
Comment:
* Fixed a bug in edit mode
* Support for localised language names
* Cleanups
Modified paths:
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/extensions/Translate/TranslatePage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/TranslatePage.php
@@ -133,7 +133,16 @@
134134 }
135135
136136 protected function languageSelector() {
137 - $languages = Language::getLanguageNames( false );
 137+ global $wgLang;
 138+ if ( is_callable(array( 'LanguageNames', 'getNames' )) ) {
 139+ $languages = LanguageNames::getNames( $wgLang->getCode(),
 140+ LanguageNames::FALLBACK_NORMAL,
 141+ LanguageNames::LIST_MW_AND_CLDR
 142+ );
 143+ } else {
 144+ $languages = Language::getLanguageNames( false );
 145+ }
 146+
138147 ksort( $languages );
139148
140149 $options = '';
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -77,18 +77,15 @@
7878 if ( $group === null ) return;
7979
8080 $en = $group->getMessage( $key, 'en' );
 81+ $xx = $group->getMessage( $key, $code );
8182
82 - $xx = TranslateUtils::getMessageContent( $key, $code );
83 - if ( $xx === null ) {
84 - $xx = $group->getMessage( $key, $code );
85 - }
86 -
8783 $fb = null;
8884 $fbcode = Language::getFallbackFor( $code );
8985 if ( $fbcode ) {
90 - $fb = TranslateUtils::getMessageContent( $key, $fbcode );
 86+ $fb = $group->getMessage( $key, $fbcode );
 87+ /* For fallback, even uncommitted translation may be useful */
9188 if ( $fb === null ) {
92 - $fb = $group->getMessage( $key, $fbcode );
 89+ $fb = TranslateUtils::getMessageContent( $key, $fbcode );
9390 }
9491 }
9592
@@ -101,7 +98,6 @@
10299 $boxes[] = self::dobox( $fb, $fbcode, 'translate-edit-message-in-fb' );
103100 }
104101
105 -
106102 if ( $xx !== null && $code !== 'en' ) {
107103 $boxes[] = self::dobox( $xx, $code, 'translate-edit-message-in' );
108104
Index: trunk/extensions/Translate/Translate.php
@@ -12,7 +12,7 @@
1313
1414 $wgExtensionCredits['specialpage'][] = array(
1515 'name' => 'Translate',
16 - 'version' => '4.0-rc5',
 16+ 'version' => '4.0',
1717 'author' => 'Niklas Laxström',
1818 'description' => 'Special page for translating Mediawiki and beyond'
1919 );
@@ -23,11 +23,20 @@
2424 $wgAutoloadClasses['MessageGroups'] = $dir . 'MessageGroups.php';
2525 $wgAutoloadClasses['TranslateEditAddons'] = $dir . 'TranslateEditAddons.php';
2626 $wgAutoloadClasses['languages'] = $IP . '/maintenance/language/languages.inc';
 27+$wgAutoloadClasses['SpecialTranslate'] = $dir . 'TranslatePage.php';
 28+$wgAutoloadClasses['SpecialMagic'] = $dir . 'SpecialMagic.php';
 29+
2730 $wgExtensionMessagesFiles['Translate'] = $dir . 'Translate.i18n.php';
2831
29 -// Baah?
30 -require_once( 'maintenance/language/messageTypes.inc' );
 32+$wgSpecialPages['Translate'] = 'SpecialTranslate';
 33+$wgSpecialPages['Magic'] = 'SpecialMagic';
3134
 35+$wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
 36+
 37+#
 38+# Configuration variables
 39+#
 40+
3241 /**
3342 * If this variable is set to false, this extension will not touch any extension
3443 * files. If set to true, files are read and included to get messages.
@@ -127,12 +136,3 @@
128137 $wgTranslateEC = array();
129138 $wgTranslateEC[] = 'core';
130139
131 -/* Add specialpage */
132 -if ( !function_exists( 'extAddSpecialPage' ) ) {
133 - require( dirname(__FILE__) . '/../ExtensionFunctions.php' );
134 -}
135 -
136 -extAddSpecialPage( dirname(__FILE__) . '/TranslatePage.php', 'Translate', 'SpecialTranslate' );
137 -
138 -$wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
139 -

Status & tagging log