Index: trunk/extensions/Translate/TranslatePage.php |
— | — | @@ -133,7 +133,16 @@ |
134 | 134 | } |
135 | 135 | |
136 | 136 | 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 | + |
138 | 147 | ksort( $languages ); |
139 | 148 | |
140 | 149 | $options = ''; |
Index: trunk/extensions/Translate/TranslateEditAddons.php |
— | — | @@ -77,18 +77,15 @@ |
78 | 78 | if ( $group === null ) return; |
79 | 79 | |
80 | 80 | $en = $group->getMessage( $key, 'en' ); |
| 81 | + $xx = $group->getMessage( $key, $code ); |
81 | 82 | |
82 | | - $xx = TranslateUtils::getMessageContent( $key, $code ); |
83 | | - if ( $xx === null ) { |
84 | | - $xx = $group->getMessage( $key, $code ); |
85 | | - } |
86 | | - |
87 | 83 | $fb = null; |
88 | 84 | $fbcode = Language::getFallbackFor( $code ); |
89 | 85 | if ( $fbcode ) { |
90 | | - $fb = TranslateUtils::getMessageContent( $key, $fbcode ); |
| 86 | + $fb = $group->getMessage( $key, $fbcode ); |
| 87 | + /* For fallback, even uncommitted translation may be useful */ |
91 | 88 | if ( $fb === null ) { |
92 | | - $fb = $group->getMessage( $key, $fbcode ); |
| 89 | + $fb = TranslateUtils::getMessageContent( $key, $fbcode ); |
93 | 90 | } |
94 | 91 | } |
95 | 92 | |
— | — | @@ -101,7 +98,6 @@ |
102 | 99 | $boxes[] = self::dobox( $fb, $fbcode, 'translate-edit-message-in-fb' ); |
103 | 100 | } |
104 | 101 | |
105 | | - |
106 | 102 | if ( $xx !== null && $code !== 'en' ) { |
107 | 103 | $boxes[] = self::dobox( $xx, $code, 'translate-edit-message-in' ); |
108 | 104 | |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | |
14 | 14 | $wgExtensionCredits['specialpage'][] = array( |
15 | 15 | 'name' => 'Translate', |
16 | | - 'version' => '4.0-rc5', |
| 16 | + 'version' => '4.0', |
17 | 17 | 'author' => 'Niklas Laxström', |
18 | 18 | 'description' => 'Special page for translating Mediawiki and beyond' |
19 | 19 | ); |
— | — | @@ -23,11 +23,20 @@ |
24 | 24 | $wgAutoloadClasses['MessageGroups'] = $dir . 'MessageGroups.php'; |
25 | 25 | $wgAutoloadClasses['TranslateEditAddons'] = $dir . 'TranslateEditAddons.php'; |
26 | 26 | $wgAutoloadClasses['languages'] = $IP . '/maintenance/language/languages.inc'; |
| 27 | +$wgAutoloadClasses['SpecialTranslate'] = $dir . 'TranslatePage.php'; |
| 28 | +$wgAutoloadClasses['SpecialMagic'] = $dir . 'SpecialMagic.php'; |
| 29 | + |
27 | 30 | $wgExtensionMessagesFiles['Translate'] = $dir . 'Translate.i18n.php'; |
28 | 31 | |
29 | | -// Baah? |
30 | | -require_once( 'maintenance/language/messageTypes.inc' ); |
| 32 | +$wgSpecialPages['Translate'] = 'SpecialTranslate'; |
| 33 | +$wgSpecialPages['Magic'] = 'SpecialMagic'; |
31 | 34 | |
| 35 | +$wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools'; |
| 36 | + |
| 37 | +# |
| 38 | +# Configuration variables |
| 39 | +# |
| 40 | + |
32 | 41 | /** |
33 | 42 | * If this variable is set to false, this extension will not touch any extension |
34 | 43 | * files. If set to true, files are read and included to get messages. |
— | — | @@ -127,12 +136,3 @@ |
128 | 137 | $wgTranslateEC = array(); |
129 | 138 | $wgTranslateEC[] = 'core'; |
130 | 139 | |
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 | | - |