Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -92,6 +92,8 @@ |
93 | 93 | 'translate-magic-submit' => 'Fetch', |
94 | 94 | 'translate-magic-cm-export' => 'Export', // cm- should be removed |
95 | 95 | |
| 96 | + 'translate-magic-nothing-to-export' => 'There is nothing to export.', |
| 97 | + |
96 | 98 | 'translate-magic-cm-to-be' => 'To-be', |
97 | 99 | 'translate-magic-cm-current' => 'Current', |
98 | 100 | 'translate-magic-cm-original' => 'Original', |
Index: trunk/extensions/Translate/SpecialMagic.php |
— | — | @@ -123,9 +123,6 @@ |
124 | 124 | $this->setup( $parameters ); |
125 | 125 | $this->setHeaders(); |
126 | 126 | |
127 | | - $wgOut->addHTML( $this->getForm() ); |
128 | | - $wgOut->addWikiMsg( self::MSG . 'help' ); |
129 | | - |
130 | 127 | if ( !$this->options['module'] ) { return; } |
131 | 128 | $o = null; |
132 | 129 | switch ( $this->options['module'] ) { |
— | — | @@ -139,24 +136,31 @@ |
140 | 137 | case self::MODULE_NAMESPACE: |
141 | 138 | $o = new NamespaceCM( $this->options['language'] ); |
142 | 139 | break; |
143 | | - |
144 | 140 | default: |
145 | | - return; |
| 141 | + // OOps. |
146 | 142 | } |
147 | 143 | |
| 144 | + $wgOut->addHTML( $this->getForm() ); |
| 145 | + |
148 | 146 | if ( $wgRequest->wasPosted() && $this->options['savetodb'] ) { |
149 | 147 | if ( !$wgUser->isAllowed( 'translate' ) ) { |
150 | 148 | $wgOut->permissionRequired( 'translate' ); |
151 | | - return; |
| 149 | + } else { |
| 150 | + $o->save( $wgRequest ); |
152 | 151 | } |
153 | | - |
154 | | - $o->save( $wgRequest ); |
155 | 152 | } |
156 | 153 | |
157 | 154 | if ( $o instanceof ComplexMessages ) { |
158 | 155 | if ( $this->options['export'] ) { |
159 | | - $result = Xml::element( 'textarea', array( 'rows' => '30' ) , $o->export() ); |
| 156 | + $output = $o->export(); |
| 157 | + if ( $output === '' ) { |
| 158 | + $wgOut->addWikiMsg( 'translate-magic-nothing-to-export' ); |
| 159 | + return; |
| 160 | + } |
| 161 | + $result = Xml::element( 'textarea', array( 'rows' => '30' ), $output ); |
160 | 162 | } else { |
| 163 | + |
| 164 | + $wgOut->addWikiMsg( self::MSG . 'help' ); |
161 | 165 | $result = $o->output(); |
162 | 166 | } |
163 | 167 | } |